substring code code example
Example 1: java substring
String s = "Let's Get This Bread";
String subString = s.substring(6, 9);
Example 2: substring
const str = 'Mozilla';
console.log(str.substring(1, 3));
console.log(str.substring(2));
Example 3: substring java
import java.lang.*;
public class StringDemo {
public static void main(String[] args) {
String str = "This is tutorials point";
String substr = "";
substr = str.substring(8, 17);
System.out.println("substring = " + substr);
substr = str.substring(0, 8);
System.out.println("substring = " + substr);
}
}