substring methog code example
Example 1: javascript substring
// zero-based index, 'end' is excluded from result
myString.substring( start, end )
Example 2: str.substring if 2 letters
public String firstTwo(String str) {
return str.length() < 2 ? str : str.substring(0, 2);
}