Android Question read caracters from a string

Rachbob

Member
Licensed User
hello everyone,

in a EditText i need to separate some words from the input text..
i use (EditText.SetSelection) and (EditText .SelectionLength) but i dont know how to copy the selected string:

Dim A As Int

EditTextH.SelectAll
A=EditTextH.SelectionLength
EditTextH.SetSelection(1,A-1)
' nedd her to copy the selected text
End Sub
 

Star-Dust

Expert
Licensed User
Longtime User
B4X:
Dim Text as String = EditTextH.Text.SubString2(StartIndex,EndIndex)
Dim Text as String = EditTextH.Text.SubString(StartIndex)
You don't need to select the text to be able to copy it. Just use the string methods to get a substring.
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4X:
dim str as string = EditTextH.Text
' Do whatever you want to do with the string or even a substring of it.
 
Upvote 0
Top