Java String Capitalize First capitalizeFirstCharacter(String s)

Here you can find the source of capitalizeFirstCharacter(String s)

Description

capitalize First Character

License

Open Source License

Declaration

public static String capitalizeFirstCharacter(String s) 

Method Source Code

//package com.java2s;

public class Main {
    public static String capitalizeFirstCharacter(String s) {
        if (s != null) {
            if (s.length() > 1) {
                s = Character.toUpperCase(s.charAt(0)) + s.substring(1);
            } else {
                s = s.toUpperCase();//from w w  w  . j  a v a 2  s  .c o  m
            }
        }
        return s;
    }

    public static String substring(StringBuffer buf, int start, int lim) {
        int len = lim - start;
        char[] result = new char[len];
        buf.getChars(start, lim, result, 0);
        return String.valueOf(result);
    }
}

Related

  1. capitalizeFirstChar(final String str)
  2. capitalizeFirstChar(String name)
  3. capitalizeFirstChar(String name)
  4. capitalizeFirstChar(String s)
  5. capitalizeFirstCharacter(final String s)
  6. capitalizeFirstCharacter(String s)
  7. capitalizeFirstCharacter(String str)
  8. capitalizeFirstCharacter(String str)
  9. CapitalizeFirstCharacter(String Str)