![]() Here, the returned substring extends to the end of the original string. The integer argument specifies the index of the first character. Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. ![]() String substring(int beginIndex, int endIndex) The substring method has two versions, as shown in the following table: The substring Methods in the String Class Method If you want to get more than one consecutive character from a string, you can use the substring method. Indices begin at 0, so the character at index 9 is 'O', as illustrated in the following figure: O roar again!" Ĭhar aChar = anotherPalindrome.charAt(9)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |