Here you can find the source of uncapitalize(String str)
public static String uncapitalize(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String uncapitalize(String str) { if (str == null || str.isEmpty()) { return str; }//from w w w. j a v a2 s .c om int capitalIndex = -1; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') { capitalIndex = i; } else { break; } } if (capitalIndex < 0) { return str; } else if (capitalIndex == str.length() - 1) { return str.toLowerCase(); } else { return str.substring(0, capitalIndex + 1).toLowerCase() + str.substring(capitalIndex + 1); } } }