String class provides number of methods for manipulating the strings. substring() is one of the method of String class that is used to get some part of the original string as String object. substring provides a way of making a copy of a piece of a String. This method has two forms:
substring(int beginIndex): This method returns a new string that will contain a substring of original string starting from the index passed as argument to the method up to the end of the original string.
substring(int beginIndex, int endIndex): This method returns a new string that will contain a substring of original string starting from the index passed as first argument up to one less than the second argument of the method i.e. from beginIndex to (endIndex-1).
To know more about substring go to the url:
http:/www.roseindia.net/java/beginners/SubstringExample.shtml
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java SubString
Post your Comment