mercredi 24 juillet 2019

How do you check if the last line character appears inside the string

I have a String that checks last character of a string. How do you check if & appears in last line not as a last character.

MobileElement checkCharacter (id = "com.samsung.text")    
String check = checkCharacter.get(2).getText().trim(); 


check.charAt(check.length() - 1) == '&'

I tried by checking index of a string. Checks character in last line:

check.indexOf('&') >= 0

By Checking indexOf is this the correct way to reformat.

Aucun commentaire:

Enregistrer un commentaire