Java String Capitalize capitalize(String message)

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

Description

Capitalize the first word and trim whitespaces.

License

Open Source License

Declaration

public static String capitalize(String message) 

Method Source Code

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

public class Main {
    /** Capitalize the first word and trim whitespaces. */
    public static String capitalize(String message) {
        message = message.trim();//from  w  w  w.  j av  a  2 s  .  c o  m
        if (message.equals(""))
            return message;
        StringBuilder buffer = new StringBuilder(message);
        char first = buffer.charAt(0);
        if (!Character.isUpperCase(first))
            buffer.setCharAt(0, Character.toUpperCase(first));
        return buffer.toString();
    }
}

Related

  1. capitalize(String input)
  2. capitalize(String input)
  3. capitalize(String inputString)
  4. capitalize(String line)
  5. capitalize(String membername)
  6. capitalize(String name)
  7. capitalize(String name)
  8. capitalize(String name)
  9. capitalize(String name)