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.
Sur cette page du site, vous pouvez voir la vidéo en ligne 21A. Java Basics for Selenium - Java Strings - String Methods durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur subbus tech 21 March 2019, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 33 fois et il a aimé 0 téléspectateurs. Bon visionnage!