Java Program to Capitalize Each Words in Strings

This is the small java code that capitalized the each word of a string. The Java built-in function is used in the code for this purpose.

Source Code 

package newpackage;
import java.util.Scanner;
import org.apache.commons.lang.WordUtils;
public class capitalizeFirst {
public static void main(String[] args) {
String userEntered, palindrome = "";
Scanner in = new Scanner(System.in);// java.util.Scanner
System.out.println("Enter some text to capitalize every first letter");
userEntered = in.nextLine();
System.out.println(WordUtils.capitalize(userEntered)); //org.apache.commons.lang.WordUtils;
}
}
Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment