RUVIDEO
Поделитесь видео 🙏

java 38 | String class methods | compareTo() method | toLowerCase() | string concat using + смотреть онлайн

📁 Лайфстайл 👁️ 16 📅 05.12.2023

String class has various methods, I am going to cover few of them.
At the end of this class students will be able to : -
Apply charAt ( ) method to find a character at particular place
Apply replace( ) method to replace one char with other
Apply compareTo( ) method to compare two strings.
Apply concat( ) method for concatenation of strings.

There are various methods available in string class
 concat(), equals(), split(), length(), replace(), compareTo(), intern(), substring() etc.
We are going to see some of the methods

int length(): Returns the number of characters in the String.
“welcome".length();  // returns 7
char charAt(int i): Returns the character at ith index. “welcome".charAt(3); // returns  ‘c’
String substring (int i): Return the substring from the ith  index character to end.
“welcomeStudents".substring(3); // returns “comeStudents”

 String replace (char oldChar, char newChar) :  Returns new string by replacing all occurrences of oldChar with newChar.
String s1 = “feeksforfeeks”;
String s2 = “feeksforfeeks”.replace(‘f’ ,’g’);
// returns “geeksgorgeeks”

int compareTo (String str2) : It compares values lexicographically and return an integer value that describes if first string is less than, greater than or equal to second string.
str1.compareTo(str2) :-
If str1 greaterThan str2 return 1
If str1lessThan str2 return -1
If str1==str2 return 0

boolean equals( Object otherObj): Compares this string to the specified object.
Boolean out = “Geeks”.equals(“Geeks”); // returns true Boolean out = “Geeks”.equals(“geeks”); // returns false

String toLowerCase(): Converts all the characters in the String to lower case.
String word1 = “HeLLo”;
String word3 = word1.toLowerCase(); // returns “hello"
String toUpperCase(): Converts all the characters in the String to upper case.
String word1 = “HeLLo”;
String word2 = word1.toUpperCase(); // returns “HELLO”

String concat( String str): Concatenates specified string to the end of this string.
String s1 = ”Welcome”;
String s2 = “Students”;
String output = s1.concat(s2);//returns “WelcomeStudents”
Other way of concatenation:
By using the “ + ” operator
String s= “welcome ” + “ Students”// welcomeStudents
Compiler will convert the above statement like this:-
String s = ( new StringBuilder( )).append(“welcome”) .append(“Students”).toString();
StringBuilder is a mutable class.
toString convert into string class
235+apartment : this will also work

summary
There are various methods in string class
We can make use of these methods in our program
To find some char at some location
To replace any character at any location
To append other string into the string
To change into upper case or lower case any string

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «java 38 | String class methods | compareTo() method | toLowerCase() | string concat using +» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.