Here you can find the source of toSentenceCase(String s, char endOfLineSym)
public static String toSentenceCase(String s, char endOfLineSym)
//package com.java2s; //License from project: Open Source License public class Main { public static String toSentenceCase(String s, char endOfLineSym) { s = s.toLowerCase();/*from ww w.j a va2 s. co m*/ int strl = s.length(); char[] holder = new char[strl]; boolean sentenceActive = true; int i = 0; while (i < strl) { char nextC = s.charAt(i); if (((sentenceActive) || (i == 0)) && (Character.isLetterOrDigit(nextC))) { nextC = Character.toUpperCase(nextC); sentenceActive = false; } if ((Character.getType(nextC) == 13) || (Character.getType(nextC) == 14) || (nextC == endOfLineSym)) { sentenceActive = true; } holder[i] = nextC; i++; } return new String(holder); } public static String toLowerCase(String s) { return s.toLowerCase(); } public static String toUpperCase(String s) { return s.toUpperCase(); } }