Quiz Complete, well Done!
Which string method is used to split a string into an array of substrings?
What happens if the start index is greater than the end index in a string slice?
Using a step value in string slicing allows you to skip characters. For example, [::2] will return
characters.
Length
Trimming
The replace() method can also be used to remove specified characters from a string by replacing them with an empty
.
Step value
Indexing
The
method returns the number of occurrences of a specified substring in a string.
Strings Methods
Start index
Which string method is used to find the index of a specific character in a string?
Which string method is used to convert a string to lowercase?
Case Conversion
What is the result of the expression "Hello".length()?
What does the 'replace' method do in Python?
What is the purpose of the join() method in Python?
What does string slicing do?
What is the output of the following code?
String str = "Hello";
System.out.println(str.replace("l", "L"));
What is the output of the following code?
String str = " Hello ";
System.out.println(str.trim());