Java String Substring

by Dan Bunker

 

Substring

Taking a portion of a larger string is known as a substring. Substrings are often used when doing any kind of string manipulation. For example, maybe you've read in a file and are storing it's content as a string. If you needed to find the first white space contained in the string and return the string from that point on, you could use the substring method to accomplish that.