B4J Question Split a string the first space

SMOOTSARA

Active Member
Licensed User
Longtime User
Hello friends

I want to separate the string from the first space

sampel_string = "from the first space"

string1 = "from"
string2 = "the first space"

tanks
 

Daestrum

Expert
Licensed User
Longtime User
B4X:
 Dim sampel_string As String = "from the first space"
Dim string1 As String = sampel_string.SubString2(0,sampel_string.IndexOf(" ")) ' from char pos 0 upto the space
Dim string2 As String = sampel_string.SubString(sampel_string.IndexOf(" ")+1)   ' from the space+1 to end of string
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…