Java String Uncapitalize uncapitalize(final CharSequence s)

Here you can find the source of uncapitalize(final CharSequence s)

Description

uncapitalize

License

Open Source License

Declaration

public static String uncapitalize(final CharSequence s) 

Method Source Code

//package com.java2s;
/*/*from  w w w. j a v a2s .  com*/
 * Copyright (c) 2015, Jean-Baptiste Giraudeau <jb@giraudeau.info>
 *
 * This file is part of "Derive4J - Annotation Processor".
 *
 * "Derive4J - Annotation Processor" is free software: you can redistribute it
 * and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * "Derive4J - Annotation Processor" 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with "Derive4J - Annotation Processor".  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Locale;

public class Main {
    public static String uncapitalize(final CharSequence s) {

        return (s.length() >= 2) && Character.isHighSurrogate(s.charAt(0)) && Character.isLowSurrogate(s.charAt(1))
                ? s.toString().substring(0, 2).toLowerCase(Locale.US) + s.toString().substring(2)
                : s.toString().substring(0, 1).toLowerCase(Locale.US) + s.toString().substring(1);
    }
}

Related

  1. uncapitalize(CharSequence cs)
  2. uncapitalize(final CharSequence sequence)
  3. uncapitalize(final String s)
  4. uncapitalize(final String str)
  5. uncapitalize(final String str)