Here you can find the source of uncapitalize(final String str)
Parameter | Description |
---|---|
str | a parameter |
public static String uncapitalize(final String str)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w . j ava 2 s . c o m * Put first letter into lowercase * * @param str * @return transformed string */ public static String uncapitalize(final String str) { if (str.length() > 1) { return str.substring(0, 1).toLowerCase() + str.substring(1); } else { return str.toUpperCase(); } } /** * a 'safe' @link {@link String#substring(int, int)} that does not throw exceptions when indexes are false. * * @param s * any string * @param startIndex * start index (maybe greater that endIndex) * @param endIndex * required end index (may greater that the string itself) * @return substring */ public static String substring(final String s, int startIndex, int endIndex) { startIndex = Math.min(s.length(), Math.max(0, startIndex)); endIndex = Math.min(s.length(), Math.max(0, endIndex)); return s.substring(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex)); } }