In this video we will see different string methods.
Different Methods of Strings:
Length of a string – length()
Getting the index of character or a substring – indexOf(Character or substring)
Getting the character at a particular position – charAt(index)
Checking if a string contains a substring – contains()
Checking if a string ends with something – endsWith()
Replacing substrings in a string – Replace, ReplaceAll, ReplaceFirst
Converting a string to lower case – toLowerCase()
Converting a string to Upper Case – toUpperCase()
Converting a String to an Integer:
To convert a string to an integer it should be a number string.
Integer.parseInt(string);
NumberFormatException:
If you try to convert a non number string to an integer, you will get this exception.
Substrings in Java:
In java you can get the substring of a string using substring() method.
If you pass only starting index for this method, you get a substring starting from the index you provided till the end of the string.
If you pass the starting index and ending index for this method, you get a substring from the starting index to the ending index not including the ending index.
On this page of the site you can watch the video online 21A. Java Basics for Selenium - Java Strings - String Methods with a duration of hours minute second in good quality, which was uploaded by the user subbus tech 21 March 2019, share the link with friends and acquaintances, this video has already been watched 33 times on youtube and it was liked by 0 viewers. Enjoy your viewing!