I have this string ffff @fgggg @
, How can I do substring last @, Thats mean When I am using this code:
String text = `ffff @fgggg @`;
selectedUser = text.substring();
I expect selectedUser be == "";
I want to check text from last @ ? If after last @
be nothing, substring()
method return "" ?
I found answer :
selectedUser = text.substring(text.lastIndexOf('@') + 1);
and I got "". It checked from last @.