Converts an input string to title case

@param input The input string
@return The title cased version of the input
431411
public static String toTitleCase(CharSequence input) {
      if (input == null) {
         return null;
      }
      return StringFunctions.TITLE_CASE.apply(input.toString());
   }
438429
public static String escapeString(String input) {
        StringBuilder escaped = new StringBuilder(input.length() + 10);
        escaped.append('"');
        for (int i = 0; i < input.length(); i++) {
            if (input.charAt(i) == '"') {
                escaped.append("\"\"");
            } else {
                escaped.append(input.charAt(i));
            }
        }
        escaped.append('"');
        return escaped.toString();
    }
717958
public static String underscored(final String input) {
        if (input == null || input.length() == 0) {
            return "";
        }

        return input.trim().replaceAll("([a-z\\d])([A-Z]+)", "$1_$2").replaceAll("[-\\s]+", "_").toLowerCase();
    }
588346
public static String doubleEncodeBrackets(final String input) {
		if (input == null || input.length() == 0) {  // For performance reasons don't use Util.empty
			return input;
		}
		return DOUBLE_ENCODE_BRACKETS.translate(input);
	}
86429
public static String toLowerCamelCase( String s )
    {
        if (StringUtil.isBlank( s )) return s.trim();

        StringBuilder sb = new StringBuilder();
        String[] parts = s.trim().split( "\\s+" );

        sb.append( parts[0].toLowerCase() );
        for (int i = 1; i < parts.length; ++i)
        {
            sb.append( capitalize( parts[i] ) );
        }

        return sb.toString();
    }
722125
public String normalize(String input) {
		char[] c = input.toCharArray();
		normalise(c);
		return new String(c);
	}
1318877
public static String toCamelCase(String str) {
		String[] wordList = str.toLowerCase().split("_");
		String finalStr = "";
		for (String word : wordList) {
			finalStr += capitalize(word);
		}
		return finalStr;
	}
1259209
public static String capitalize(final Object target) {

        if (target == null) {
            return null;
        }
        final StringBuilder result = new StringBuilder(target.toString());
        if (result.length() > 0) {
            result.setCharAt(0, Character.toTitleCase(result.charAt(0)));
        }
        return result.toString();

    }
681444
public static String uncapitalize(final String input)
   {
      if ((input == null) || (input.length() == 0))
      {
         return input;
      }
      return input.substring(0, 1).toLowerCase() + input.substring(1);
   }
745138
public function title($string)
    {
        $string = explode(' ', $string);
        foreach ($string as $key => $value) {
            if (!empty($value) && mb_strtoupper($value) == $value) {
                $string[$key] = mb_strtolower($value);
            }
        }

        return TextFormatter::titleCase(implode(' ', $string));
    }
335574
public String filter(final String input) {
		reset();
		String s = input;

		debug("************************************************");
		debug("              INPUT: " + input);

		s = escapeComments(s);
		debug("     escapeComments: " + s);

		s = balanceHTML(s);
		debug("        balanceHTML: " + s);

		s = checkTags(s);
		debug("          checkTags: " + s);

		s = processRemoveBlanks(s);
		debug("processRemoveBlanks: " + s);

		s = validateEntities(s);
		debug("    validateEntites: " + s);

		debug("************************************************\n\n");
		return s;
	}
221639
public static List<Token> tokenize(final String input) {
        List<Token> result = new ArrayList<Token>();
        if (input == null) {
            return result;
        }

        final int WHITESPACE = 0;
        final int WORD = 1;
        final int STRINGDQ = 2;
        final int STRINGSQ = 3;
        final int COMMENT = 4;

        int state = WHITESPACE;
        char ch; // character in hand
        int tokenIndex = -1;
        StringBuilder token = new StringBuilder("");

        for (int i = 0; i < input.length(); i++) {
            ch = input.charAt(i);
            switch (state) {
                case WHITESPACE:
                    if (Character.isWhitespace(ch)) {
                        // keep state
                    } else if (Character.isLetterOrDigit(ch) || ch == '_') {
                        state = WORD;
                        tokenIndex = i;
                        token.append(ch);
                    } else if (ch == '"') {
                        state = STRINGDQ;
                        tokenIndex = i;
                    } else if (ch == '\'') {
                        state = STRINGSQ;
                        tokenIndex = i;
                    } else if (ch == '#') {
                        state = COMMENT;
                    } else {
                        state = WORD;
                        tokenIndex = i;
                        token.append(ch);
                    }
                    break;

                case WORD:
                    if (Character.isWhitespace(ch)) {
                        // submit token
                        result.add(new Token(tokenIndex, token.toString()));
                        token.setLength(0);
                        state = WHITESPACE;
                    } else if (Character.isLetterOrDigit(ch) || ch == '_') {
                        token.append(ch); // and keep state
                    } else if (ch == '"') {
                        if (i < input.length()-1 && input.charAt(i+1) == '"' ) {
                            // Yes, it's somewhat wrong in terms of statemachine, but it's the
                            // simplest and crearest way.
                            token.append('"');
                            i++;
                            // and keep state.
                        } else {
                            state = STRINGDQ; // but don't append; a"b"c is the same as abc.
                        }
                    } else if (ch == '\'') {
                        if (i < input.length()-1 && input.charAt(i+1) == '\'' ) {
                            // Yes, it's somewhat wrong in terms of statemachine, but it's the
                            // simplest and crearest way.
                            token.append('\'');
                            i++;
                            // and keep state.
                        } else {
                            state = STRINGSQ; // but don't append; a"b"c is the same as abc.
                        }
                    } else if (ch == '#') {
                        // submit token
                        result.add(new Token(tokenIndex, token.toString()));
                        token.setLength(0);
                        state = COMMENT;
                    } else {
                        // for now we do allow special chars in words
                        token.append(ch);
                    }
                    break;

                case STRINGDQ:
                    if (ch == '"') {
                        if (i < input.length() - 1 && input.charAt(i+1) == '"') {
                            token.append('"');
                            i++;
                            // and keep state
                        } else {
                            state = WORD;
                        }
                    } else {
                        token.append(ch);
                    }
                    break;

                case STRINGSQ:
                    if (ch == '\'') {
                        if (i < input.length() - 1 && input.charAt(i+1) == '\'') {
                            token.append('\'');
                            i++;
                            // and keep state
                        } else {
                            state = WORD;
                        }
                    } else {
                        token.append(ch);
                    }
                    break;

                case COMMENT:
                    // eat ch
                    break;

                default:
                    assert false : "Unknown state in Shell.tokenize() state machine";
                    break;
            }
        }

        if (state == WORD || state == STRINGDQ || state == STRINGSQ) {
            result.add(new Token(tokenIndex, token.toString()));
        }

        return result;
    }
1108142
public static String toTitleCase( final String camel )
    {
        if (camel==null) {
            return null;
        }
        StringBuffer    buffer = new StringBuffer( camel.length() + 10 );
        char            ch;

        //      TBD: needs refactoring, cleanup, method cohesiveness, SRP.
        for ( int ii = 0; ii < camel.length(); ii++ )
        {
            ch = camel.charAt( ii );

            //
            //      This will handle lower camel and avoid adding a
            //          space at the start
            //
            if ( ii == 0 )
            {
                if ( Character.isLowerCase( ch ) )
                {
                    buffer.append( Character.toUpperCase( ch ) );
                }
                else
                {
                    buffer.append( ch );
                }
            }
            else
            {
                if ( Character.isUpperCase( ch ) )
                {
                    buffer.append( " " ).append( ch );
                }
                else
                {
                    buffer.append( ch );
                }
            }
        }

        return buffer.toString();
    }
730511
static function titleCase($string, $delimiter = '') {
		return implode($delimiter, array_map('ucfirst', self::getWords($string, true)));
	}
616124
public static String capitalize(final String string)
   {
      if (string == null)
         throw new IllegalArgumentException("string");
      if (string.equals(""))
         throw new IllegalArgumentException("string");

      return Character.toUpperCase(string.charAt(0)) + string.substring(1);
   }
1115759
public static String toTitleCase(String str) {
        if (str.length() == 0) {
            return str;
        } else {
            return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase();
        }
    }
133218
public static String caseCanonicalize(String s) {
    for (int i = 0, n = s.length(); i < n; ++i) {
      char ch = s.charAt(i);
      char cu = caseCanonicalize(ch);
      if (cu != ch) {
        StringBuilder sb = new StringBuilder(s);
        sb.setCharAt(i, cu);
        while (++i < n) {
          sb.setCharAt(i, caseCanonicalize(s.charAt(i)));
        }
        return sb.toString();
      }
    }
    return s;
  }