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.
In questa pagina del sito puoi guardare il video online 21A. Java Basics for Selenium - Java Strings - String Methods della durata di ore minuti seconda in buona qualità , che l'utente ha caricato subbus tech 21 March 2019, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 33 volte e gli è piaciuto 0 spettatori. Buona visione!