Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getTitleCase(String input) {

        String titleCase = "";
        String[] parts = input.split(" ");

        for (int i = 0; i < parts.length; i++) {
            titleCase += Character.toUpperCase(parts[i].charAt(0)) + parts[i].substring(1).toLowerCase();

            if (i != parts.length - 1) {
                titleCase += " ";
            }
        }

        return titleCase;
    }
}