Java String Capitalize capitalise(String s)

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

Description

Describe what the method does

License

Open Source License

Parameter

Parameter Description
s Describe what the parameter does

Return

Describe the return value

Declaration

public static String capitalise(String s) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w  w w .j  a v a 2  s. c  o  m*/
     * Describe what the method does
     *
     * @todo-javadoc Write javadocs for method
     * @todo-javadoc Write javadocs for method parameter
     * @todo-javadoc Write javadocs for return value
     * @param s Describe what the parameter does
     * @return Describe the return value
     */
    public static String capitalise(String s) {
        if (s.equals("")) {
            return "";
        }
        if (s.length() == 1) {
            return s.toUpperCase();
        } else {
            String caps = s.substring(0, 1).toUpperCase();
            String rest = s.substring(1);
            return caps + rest;
        }
    }

    /**
     * Describe what the method does
     *
     * @todo-javadoc Write javadocs for method
     * @todo-javadoc Write javadocs for method parameter
     * @todo-javadoc Write javadocs for method parameter
     * @todo-javadoc Write javadocs for return value
     * @param a Describe what the parameter does
     * @param b Describe what the parameter does
     * @return Describe the return value
     */
    public static boolean equals(Object a, Object b) {
        if (a == null && b == null) {
            return true;
        }
        if (a != null && a.equals(b)) {
            return true;
        }
        return false;
    }
}

Related

  1. capitalise(final String name)
  2. capitalise(String line)
  3. capitalise(String name)
  4. capitalise(String s)
  5. capitalise(String s)
  6. capitalise(String s)
  7. capitalise(String str)
  8. capitalise(String str)
  9. capitalise(String str)