Hypertrophy Posted July 24, 2009 Share 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 Link to comment Share on other sites More sharing options...
Hypertrophy Posted July 24, 2009 Author Share 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? Link to comment Share on other sites More sharing options...
philw Posted July 24, 2009 Share 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]]) Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 24, 2009 Share 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 Link to comment Share on other sites More sharing options...
trancexx Posted July 25, 2009 Share 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 Link to comment Share on other sites More sharing options...
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