Java Substring | HackerRank java challenge 7

Опубликовано: 26 Декабрь 2021
на канале: Success Learners
171
8

A part of String is called substring. In other words, substring is a subset of another String. Java String class provides the built-in substring() method that extract a substring from the given string by using the index values passed as an argument. In case of substring() method startIndex is inclusive and endIndex is exclusive.

Suppose the string is "computer", then the substring will be com, compu, ter, etc.



public String substring(int startIndex):
This method returns new String object containing the substring of the given string from specified startIndex (inclusive). The method throws an IndexOutOfBoundException when the startIndex is larger than the length of String or less than zero.
public String substring(int startIndex, int endIndex):
This method returns new String object containing the substring of the given string from specified startIndex to endIndex. The method throws an IndexOutOfBoundException when the startIndex is less than zero or startIndex is greater than endIndex or endIndex is greater than length of String.


На этой странице сайта вы можете посмотреть видео онлайн Java Substring | HackerRank java challenge 7 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Success Learners 26 Декабрь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 171 раз и оно понравилось 8 зрителям. Приятного просмотра!