Java - Write code to convert camel case Pascal case

Requirements

Write code to convert camel case Pascal case

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String source = "AbcDef book2s.com";
        System.out.println(camel2Pascal(source));
    }//ww w . j  av  a  2s.c  o m

    public static String camel2Pascal(String source) {
        return source.replaceFirst(source.substring(0, 1), source
                .substring(0, 1).toUpperCase());
    }
}

Related Exercise