Java String Capitalize capitalise(final String name)

Here you can find the source of capitalise(final String name)

Description

capitalise

License

Apache License

Declaration

public static String capitalise(final String name) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file

public class Main {
    public static String capitalise(final String name) {
        String s = name;//from ww w .  j  a  va  2  s.c  o m

        switch (s.length()) {
        case 0: {
            break;
        }

        case 1: {
            s = name.toUpperCase();
            break;
        }

        default: {
            s = name.substring(0, 1).toUpperCase() + name.substring(1);
            break;
        }
        }

        return s;
    }
}

Related

  1. capitalise(String line)
  2. capitalise(String name)
  3. capitalise(String s)
  4. capitalise(String s)