"substring" before given character

bjf

Member
Licensed User
Longtime User
I'm probably extreamly blind but i can't find a function to use if i would like
to make a substring of a text and use a specific character as end "index".

e.g.
How would i go about it to return "1234" from the string "1234_5678"

the underscore can be at different positions, so i can't use substring2

bset regards
 

walterf25

Expert
Licensed User
Longtime User
Substring

you can use

B4X:
Dim pos as int
pos = string.IndexOf("_")
newstring = string.Substring2(0, pos)

Something like that!
 
Upvote 0
Top