Android Question inStr(in VB - does a string contain "..") - how to in B4A?

Almog

Active Member
Licensed User
hi,

I need to search for a word in a string.
I tried InStr, but its not exist.
Does someone knows how can I search for some
String in other string (like inStr on VB)?

Thanks.
 

Marcus Araujo

Member
Licensed User
Longtime User
That's right... just complementing, you could also make use of .IndexOf2 if you want to specify a starting point. You may also find useful .LastIndexOf(2).
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
you can explain please?

upload_2018-3-26_18-50-8.png



upload_2018-3-26_18-50-17.png
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
B4X:
Private txt = "This is a short sentence" As String
Private i As Int
i = txt.IndexOf("short")
Returns 10
10 = index of the beginning of the search text.
If the search text is not found, the method returns -1.
 
Upvote 0
Top