Java Utililty Methods String Case Insert

List of utility methods to do String Case Insert

Description

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

Method

Stringinvert(final String s)
invert
char[] cs = s.toCharArray();
char[] result = new char[s.length()];
int j = 0;
int i = s.length() - 1;
while (i >= 0) {
    result[j++] = cs[i--];
return new String(result);
...
Stringinvert(String s)
invert
StringBuilder sb = new StringBuilder(s.length());
for (int i = s.length() - 1; i >= 0; i--) {
    sb.append(s.charAt(i));
return sb.toString();
StringinvertCase(String line)
invert Case
char[] chars = line.toCharArray();
char c;
boolean changed = false;
for (int i = 0; i < chars.length; i++) {
    c = chars[i];
    if (Character.isLowerCase(c)) {
        chars[i] = Character.toUpperCase(c);
        changed = true;
...
StringinvertCase(String str)
invert Case
int strLen;
if (str == null || (strLen = str.length()) == 0) {
    return str;
StringBuilder builder = new StringBuilder(strLen);
char ch = 0;
for (int i = 0; i < strLen; i++) {
    ch = str.charAt(i);
...
StringinvertDate(String sDate)
invert Date
String retVal = sDate;
if (sDate != null) {
    if (sDate.length() == 6) {
        retVal = sDate.substring(4, 6) + sDate.substring(2, 4) + sDate.substring(0, 2);
    } else {
        retVal = sDate.substring(4, 8) + sDate.substring(2, 4) + sDate.substring(0, 2);
return retVal;
Stringinverter(String str)
inverter
return new StringBuilder(str).reverse().toString();
Stringinverter(String string)
inverter
if (isEmpty(string)) {
    return null;
StringBuilder inverter = new StringBuilder();
for (int i = string.length() - 1; i >= 0; i--) {
    inverter.append(string.charAt(i));
return inverter.toString();
...
StringinverterString(String palavra)
inverter String
if (isEmpty(palavra))
    return "";
String[] letras = palavra.split("");
int ultimoValor = letras.length - 1;
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i <= ultimoValor; i++) {
    stringBuilder.append(letras[ultimoValor - i]);
return stringBuilder.toString();
StringinvertHostName(String hostNameIn)
invert Host Name
StringBuffer hostNameOut = new StringBuffer();
char tokens[] = hostNameIn.toCharArray();
int lastScanStart = hostNameIn.length() - 1;
int currentIndex = lastScanStart;
while (currentIndex != -1) {
    if (tokens[currentIndex] == '.') {
        if (lastScanStart - currentIndex != 0) {
            hostNameOut.append(tokens, currentIndex + 1, lastScanStart - currentIndex);
...
StringinvertKanaCase(String result)
Swap hiragana and katakana
StringBuffer foldedStringBuffer = new StringBuffer(result);
int length = foldedStringBuffer.length();
for (int i = 0; i < length; i++) {
    char character = foldedStringBuffer.charAt(i);
    if ((character >= 0x30a1) && (character < 0x30f4)) {
        foldedStringBuffer.setCharAt(i, (char) (character - 96));
    } else if ((character >= 0x3041) && (character < 0x3094)) {
        foldedStringBuffer.setCharAt(i, (char) (character + 96));
...