Java Tutorial 53 - The String Class 5-5
Obtaining Substrings
String s1 = "Welcome to Java";
Method Description
substring(beginIndex) Returns this string’s substring that begins with the character at the specified beginIndex
and extends to the end of the string, as shown in
e.g.
s1.substring(11); // Java
substring(beginIndex,endIndex) Returns this string’s substring that begins at the specified beginIndex
and extends to the character at index endIndex – 1
Note the character at endIndex is not part of the substring.
s1.substring(0,11); // Welcome to
Finding a Character or a Substring in a String
String s1 = "Welcome to Java";
Method Description
indexOf (ch) Returns the index of the first occurrence of ch in the string. Returns −1 if not matched.
s1.indexOf('W'); // 0
s1.indexOf('o'); // 4
indexOf(ch, fromIndex) Returns the index of the first occurrence of ch after fromIndex in the string.
Returns −1 if not matched.
s1.indexOf('o', 5); // 9
indexOf(s) Returns the index of the first occurrence of string s in this string. Returns −1
if not matched.
s1.indexOf("come"); // 3
indexOf(s, fromIndex) Returns the index of the first occurrence of string s in this string after fromIndex.
Returns −1 if not matched.
s1.indexOf("Java", 5); // 11
s1.indexOf("Java", 5); // -1
lastIndexOf(ch) Returns the index of the last occurrence of ch in the string. Returns −1 if not matched.
s1.lastIndexOf('W'); // 0
s1.lastIndexOf('o'); // 9
lastIndexOf(ch, fromIndex) Returns the index of the last occurrence of ch before fromIndex in this string.
Returns −1 if not matched.
s1.lastIndexOf('o', 5); // 4
lastIndexOf(s) Returns the index of the last occurrence of string s. Returns −1 if not matched.
s1.lastIndexOf("Java"); // 11
lastIndexOf(s, fromIndex) Returns the index of the last occurrence of string s before fromIndex. Returns −1 if not matched.
s1.lastIndexOf("Java", 5); // -1
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Tutorial 53 - The String Class 5-5», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.