Could someone please tell me how to determine only the first name from an edittext that contains a first and last name? I've only managed to do the opposite with IndexOf and SubString. Thanks.
That was a simple and quick solution, but yes, you will have to validate the existence of a First and Last Name, like this:
B4X:
If EditText1.Text.IndexOf(" ") > -1 Then
FirstName = EditText1.Text.SubString2(0, EditText1.Text.IndexOf(" "))
Msgbox("First Name is " & FirstName, "")
End If
Of course you can make this code more robust as needed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.