Here you can find the source of decapitalize(String string)
Parameter | Description |
---|---|
string | the string to change |
public static String decapitalize(String string)
//package com.java2s; /* Copyright 2010 - 2014 by Brian Uri! /*from w w w .j a v a 2 s .c om*/ This file is part of DDMSence. This library is free software; you can redistribute it and/or modify it under the terms of version 3.0 of the GNU Lesser General Public License as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with DDMSence. If not, see <http://www.gnu.org/licenses/>. You can contact the author at ddmsence@urizone.net. The DDMSence home page is located at http://ddmsence.urizone.net/ */ public class Main { /** * Lowers the first letter of a String. Silently does nothing if the string is null, empty, or not a letter. * * @param string the string to change * @return the changed string */ public static String decapitalize(String string) { if (isEmpty(string)) return (string); if (string.length() == 1) return (string.toLowerCase()); return (string.substring(0, 1).toLowerCase() + string.substring(1, string.length())); } /** * Checks if a String value is empty. An empty string is defined as one that is null, contains only whitespace, or * has length 0. * * @param value the value to check. * @return a boolean, true if the value is null or zero-length, false otherwise */ public static boolean isEmpty(String value) { return (value == null || value.trim().length() == 0); } }