Yata Posted June 8, 2008 Posted June 8, 2008 (edited) I had an idea for a program that when a user inputed a URL from deviantART into an input box, it would trim the URL of useless parts and create a thumb code [similar to bbcode]. All parts of the URL except the bolded are useless in this situation:http://username.deviantart.com/art/art-name-82878556The problem is I can't just use StringLeft because the amount of numbers can vary. What I need is a way to evaluate the URL from right to left and stop when it hits the last number in the sequence.I can figure out the rest of it myself, I just need some help getting the right part of the url.So in simple terms I need to extract the last sequence of numbers which amount can vary, from a URL.Can anyone please help? Edited June 9, 2008 by Yata
AdmiralAlkex Posted June 9, 2008 Posted June 9, 2008 Edit:I just noticed all the URLs have a - right before the first number. Could that be used in some way?You could use StringInStr() or StringRegExp() to find the right position and then StringLen() and StringRight() to get the numbers. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Xandl Posted June 9, 2008 Posted June 9, 2008 Hello, just the numbers, like this? $s='http://username.deviantart.com/art/art-name-82878556' $a = StringRegExp($s,'.+-(\d+)',3) If Not @error Then ConsoleWrite($a[0]) EndIf ciao Xandl
jvnorris Posted June 9, 2008 Posted June 9, 2008 Also if the "-" is an indicator or active part of the address you can just use that as the delimiter and cut from there
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now