Android String Case Convert capitalizeFirst(CharSequence movementTitle)

Here you can find the source of capitalizeFirst(CharSequence movementTitle)

Description

capitalize First

License

Open Source License

Declaration

public static CharSequence capitalizeFirst(CharSequence movementTitle) 

Method Source Code

//package com.java2s;
/*//from  w ww.j av  a2 s .c o  m
 * This file is part of Lollipop Budget.
 * Lollipop Budget is free software: you can redistribute it and/or modify
 * it under the terms of version 3 of the GNU General Public License as published by
 * the Free Software Foundation
 * Lollipop Budget 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 Lollipop Budget. If not, see <http://www.gnu.org/licenses/>.
 */

import android.text.TextUtils;

import java.util.Locale;

public class Main {
    public static CharSequence capitalizeFirst(CharSequence movementTitle) {
        if (TextUtils.isEmpty(movementTitle))
            return movementTitle;
        return String.valueOf(movementTitle.charAt(0)).toUpperCase(
                Locale.ENGLISH)
                + movementTitle.toString().substring(1)
                        .toLowerCase(Locale.ENGLISH);
    }
}

Related

  1. toUpper(char ch)
  2. toLowerSubset(String source, char substitute)
  3. UpperCase(String str)
  4. capitalize(String s)
  5. capitalize(final String str)