Me n My Programming

If Only I Have TIme

Capitalizing the Word!

I was creating a method that write setter and getter method for test template. So I need the first letter of every variable name to be capitalized (as it is a standard in setter and getter method naming convention). I google around and found that you can used the WordUtils to do that. Here is an example:

variable: time

setter n getter: setTime() and getTime()

WordUtils.capitalize(“time”); -> Time

so what I did:

String setterTime = “set” + WordUtils.capitalize(“time”) + “( );”;

output: setTime();

More info on WordUtils click here

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on February 1, 2011 by in Java, Life on Marama.
%d bloggers like this: