How to Convert String to Initcap Using Java

 Posted On  | Yashwant Chavan 

Sample code convert input string into init cap letter using java,First we convert the input string into char array. Then convert its first letter to Upper Case.

toInitCap() method


public class InitCapExample {
	public static void main(String[] args) {

	public static String toInitCap(String param) {
		if(param != null && param.length()>0){			
			char[] charArray = param.toCharArray(); // convert into char array
			charArray[0] = Character.toUpperCase(charArray[0]); // set capital letter to first postion
			return new String(charArray); // return desired output
			return "";



Tags Java 

HTML Comment Box is loading comments...

Hi I am Yashwant Chavan founder of, Purpose of this website to share the programming knowledge in the form post , blogs and articles.

Latest Updates

Stay updated with latest post, articles and technical discussions.

Most Popular Articles

© 2016

 |  Find us on Google+ |  Rss Feed

Loaded in 0.0433 seconds.