Sign in to follow this  
Followers 0
Hypertrophy

extract substring from string

5 posts in this topic

#1 ·  Posted (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 by Hypertrophy

Share this post


Link to post
Share on other sites



think i found solution:

$string = "john/luke/matthew/paul"
$array = StringSplit($string, "/")
$i = $array[0]
MsgBox(0,"",$array[$i])

am i right?

Share this post


Link to post
Share on other sites

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]])

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0