Here you can find the source of uncapitalizeWord(String word)
word
to lower case.
Parameter | Description |
---|---|
word | the string to convert |
public static String uncapitalizeWord(String word)
//package com.java2s; //License from project: Apache License public class Main { /**// www . j av a 2 s. com * Convert the initial of given string <code>word</code> to lower case. * <p> * Examples: * <blockquote><pre> * StringUtil.uncapitalizeWord("hello") return "Hello" * StringUtil.uncapitalizeWord("World") return "World" * StringUtil.uncapitalizeWord(" ") return " " * StringUtil.uncapitalizeWord(null) return null * </pre></blockquote> * @param word the string to convert * @return if given string is a valid string, then return string with * lower case initial character, otherwise return the input string. */ public static String uncapitalizeWord(String word) { String result = null; if (isValid(word)) { result = word.substring(0, 1).toLowerCase() + word.substring(1); } else { return word; } return result; } /** * Verify whether the given string <code>str</code> is valid. If the given * string is not null and contains any alphabet or digit, then the string * is think as valid, otherwise invalid. * @param str string to verify * @return false if the given string is null or contains only empty character, * otherwise return true. */ public static boolean isValid(String str) { boolean valid = true; if ((str == null) || (str.trim().length() <= 0)) { valid = false; } return valid; } }