IndexOf function

stratus

Active Member
Licensed User
Longtime User
I have a text which contains this phrase studentName="A Name" and i want to use the indexOf function to find the position of the phrase,but i can not because the phrase has quotes.Is any way to find the position of the phrase?
 

glook

Member
Licensed User
Longtime User
Here you go, try one of these:

B4X:
Dim text2test as String   ' this would hold your input text
Dim pos as Int

pos = text2text.IndexOf("studentName=" & QUOTE & "A Name" & QUOTE)

or alternatively

B4X:
pos = text2text.IndexOf("studentName=~A Name~".Replace("~", QUOTE))
 
Upvote 0
Top