+ 2
What is substring in java and how to use it?
2 ответов
+ 18
The substring begins with the character at the specified index and extends to the end of this string...
.
.
This will definitely help you.👇
https://www.geeksforgeeks.org/substring-in-java/amp/
+ 1
Substring as the name says is a part of a string. In Java, the substring method can either take a single parameter and print the string content from that index to the end of the string.
Or you can pass two parameters, where the first one in the starting index and the second one is the last index which is not included.
String name = "Shashank";
System.out.println(name.substring(2));
// This will print -> ashank
System.out.println(name.substring(2,6));
// This will print -> asha