Android Utililty Methods String Case Convert

List of utility methods to do String Case Convert

Description

The list of methods to do String Case Convert are organized into topic(s).

Method

StringCoverFirstWordUp(String string)
Cover First Word Up
String str = null;
if (string != null && !"".equals(string)) {
    str = string.substring(0, 1).toUpperCase()
            + string.substring(1);
return str;
StringtoLowerCase(String src)
Safely convert the string to lowercase.
if (src == null) {
    return null;
} else {
    return src.toLowerCase();
StringswapCase(String str)
swap Case
if (str == null) {
    return null;
char[] charArray = str.toCharArray();
for (int i = 0; i < charArray.length; i++) {
    if (Character.isLowerCase(charArray[i])) {
        charArray[i] = Character.toUpperCase(charArray[i]);
    } else {
...
StringtoLowerCase(String str)
to Lower Case
if (str == null) {
    return null;
return str.toLowerCase();
StringtoLowerCase(String str, int beginIndex, int endIndex)
to Lower Case
if (str == null) {
    return null;
StringBuilder sb = new StringBuilder();
if (beginIndex < 0) {
    beginIndex = 0;
if (endIndex > str.length()) {
...
StringtoUpperCase(String str)
to Upper Case
if (str == null) {
    return null;
return str.toUpperCase();
StringtoUpperCase(String str, int beginIndex, int endIndex)
to Upper Case
if (str == null) {
    return null;
StringBuilder sb = new StringBuilder();
if (beginIndex < 0) {
    beginIndex = 0;
if (endIndex > str.length()) {
...
booleanendsWithIgnoreCase(String str, String suffix)
Examine a string to see if it ends with a given suffix (case insensitive).
int len = suffix.length();
return str.regionMatches(true, str.length() - len, suffix, 0, len);
MaplowercaseKeys(Map map)
Given a map, creates and returns a new map in which all keys are the lower-cased version of each key.
Map<String, V> result = new HashMap<String, V>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
    String key = entry.getKey();
    if (result.containsKey(key.toLowerCase())) {
        throw new IllegalArgumentException(
                "Duplicate string key in map when lower casing");
    result.put(key.toLowerCase(), entry.getValue());
...
booleanstartsWithIgnoreCase(String str, String prefix)
Examine a string to see if it starts with a given prefix (case insensitive).
return str.regionMatches(true, 0, prefix, 0, prefix.length());