Java String Capitalize capitalize(String data)

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

Description

capitalize

License

Open Source License

Declaration

public static String capitalize(String data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private StringBuffer sb = null;

    public static String capitalize(String data) {
        StringBuffer sbuf = new StringBuffer(data.length());
        sbuf.append(data.substring(0, 1).toUpperCase()).append(data.substring(1));
        return sbuf.toString();
    }/* w ww  . ja  v  a  2  s  .  c  o  m*/

    public static String capitalize(String data, int pos) {
        StringBuffer buf = new StringBuffer(data.length());
        buf.append(data.substring(0, pos - 1));
        buf.append(data.substring(pos - 1, pos).toUpperCase());
        buf.append(data.substring(pos, data.length()));
        return buf.toString();
    }

    public void append(String str) {
        sb.append(str);
    }
}

Related

  1. capitalize(final String value)
  2. capitalize(final String word)
  3. capitalize(String capitalizeMe)
  4. capitalize(String constraint)
  5. capitalize(String content)
  6. capitalize(String english)
  7. capitalize(String in)
  8. capitalize(String in)
  9. capitalize(String in)