Here you can find the source of capitalizeFully(String str, final char... delimiters)
public static String capitalizeFully(String str, final char... delimiters)
//package com.java2s; //License from project: Open Source License public class Main { public static String capitalizeFully(String str, final char... delimiters) { final int delimLen = delimiters == null ? -1 : delimiters.length; if (isEmpty(str) || delimLen == 0) { return str; }// w ww.ja va 2s.c o m str = str.toLowerCase(); return capitalize(str, delimiters); } public static boolean isEmpty(final CharSequence cs) { return cs == null || cs.length() == 0; } public static String capitalize(final String str, final char... delimiters) { final int delimLen = delimiters == null ? -1 : delimiters.length; if (isEmpty(str) || delimLen == 0) { return str; } final char[] buffer = str.toCharArray(); boolean capitalizeNext = true; for (int i = 0; i < buffer.length; i++) { final char ch = buffer[i]; if (isDelimiter(ch, delimiters)) { capitalizeNext = true; } else if (capitalizeNext) { buffer[i] = Character.toTitleCase(ch); capitalizeNext = false; } } return new String(buffer); } private static boolean isDelimiter(final char ch, final char[] delimiters) { if (delimiters == null) { return Character.isWhitespace(ch); } for (final char delimiter : delimiters) { if (ch == delimiter) { return true; } } return false; } }