Obtaining Substrings
You can obtain a single character from a string using the charAt() method. You can also obtain a substirng from a string using the substring method in the String class.
java.lang.String
+substring(beginIndex: int) this string's substring that begins with the character at the specified beginIndex and extends to the end of the string.
+substring(beginIndex: int, endIndex: int) this string's substring that begins with the character at the specified beginIndex and extends to specified endIndex of the string.
Note But it will not include endIndex character in substring.