Hypertrophy Posted July 24, 2009 Posted July 24, 2009 (edited) if my string looks like this: $string = "joe/bob/mathew/john" and i do: StringSplit($string, "/") how do i extract the last substring (in this case john) i got from stringsplitting the above string using the searchstring "/" Edited July 24, 2009 by Hypertrophy
Hypertrophy Posted July 24, 2009 Author Posted July 24, 2009 think i found solution: $string = "john/luke/matthew/paul" $array = StringSplit($string, "/") $i = $array[0] MsgBox(0,"",$array[$i]) am i right?
philw Posted July 24, 2009 Posted July 24, 2009 StringSplit puts the substrings it finds in an array, with the total number stored in array element 0. So: #include <String.au3> Dim $stringarray[100] $string = "joe/bob/mathew/john" $stringarray=StringSplit($string,"/") MsgBox(0,"",$stringarray[$stringarray[0]])
AdmiralAlkex Posted July 24, 2009 Posted July 24, 2009 You could also use UBound, it doesn't really matter much $string = "joe/bob/mathew/john" $array = StringSplit($string, "/") MsgBox(0, "", $array[UBound($array)-1]) .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
trancexx Posted July 25, 2009 Posted July 25, 2009 You could make a combination, it doesn't really make sense $string = "joe/bob/mathew/john" $array = StringSplit($string, "/") MsgBox(0, "", $array[(((UBound($array) - 1) * 2 + 18) / 2 - 9) ^ 2 / $array[0]]) ♡♡♡ . eMyvnE
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