Say I have this string :
/mytea/en/bt/aer?taxYear=2021&startMonth=1&endMonth=1
There are three parameters there :
- taxYear : 4 digits => like "2021"
- startMonth : 1 digit or 2 digits => from 1 to 12
- endMonth: 1 digit or 2 digits => from 1 to 12
How can I do to extract these parameters from the string in Java or Scala?
I have already tried this :
public static void main(String []args){
String hello = "/mytea/en/bt/aer?taxYear=2021&startMonth=1&endMonth=1";
String test = hello.substring(52, 53);
System.out.println(test);
}
And it returns "1", while test = endMonth.
However if I change the value of endMonth in the url by "10", it still returns "1", and not 10.