Android Utililty Methods String Sub String Get

List of utility methods to do String Sub String Get

Description

The list of methods to do String Sub String Get are organized into topic(s).

Method

StringsubstringBefore(String text, char separator)
Gives the substring of the given text before the given separator.
if (isEmpty(text)) {
    return text;
int sepPos = text.indexOf(separator);
if (sepPos < 0) {
    return text;
return text.substring(0, sepPos);
...
StringsubstringBeforeLast(String text, char separator)
Gives the substring of the given text before the last occurrence of the given separator.
if (isEmpty(text)) {
    return text;
int cPos = text.lastIndexOf(separator);
if (cPos < 0) {
    return text;
return text.substring(0, cPos);
...