Java String Capitalize capitalize(String s)

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

Description

capitalize

License

Open Source License

Declaration

public static String capitalize(String s) 

Method Source Code

//package com.java2s;

public class Main {
    public static String capitalize(String s) {
        int len = s.length();
        if (len == 0)
            return s;
        else if (len == 1)
            return Character.toUpperCase(s.charAt(0)) + "";
        else//from w  w  w . j  a  va  2  s.  co m
            return Character.toUpperCase(s.charAt(0)) + s.substring(1);
    }
}

Related

  1. capitalize(String s)
  2. capitalize(String s)
  3. capitalize(String s)
  4. capitalize(String s)
  5. capitalize(String s)
  6. capitalize(String s, char delimiter)
  7. capitalize(String s, String fullstring)
  8. capitalize(String source)
  9. capitalize(String src)