Java Substring

If we have an entire String, for example:

“cebu cm solutions”

we can take part of that String by calling the String.substring(<index>); or by String.substring(<firstindex>, <lastindex>).

if we would like to display “cm solutions”, just use String.substring(5);

if we would like to display “cm” just use String.substring(5,7);

NOTE: Always remember in Java that String is an Object, not a primitive variable

See another tutorial here:

http://www.tutorialspoint.com/java/java_string_substring.htm

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