Check out example codes for "how to do substring java". It will help you in understanding the concepts better.

Code Example 1

class Main {
  public static void main (String[] args) {
    String str = "Hello World!";
    String firstWord = str.substring(0, 5);
    //two parameters are start and end index: (inclusive, non-inclusive)
    String secondWord = str.substring(6, 11);
    //firstWord has string "Hello"
    //secondWord has string "World"

Learn ReactJs, React Native from