if (stringOne.substring(1,5) == "R")
Will return element 1 to 5 so it will never be equal to "R"
You need to fetch only the first character
if (stringOne.substring(1,5) == "R")
Will return element 1 to 5 so it will never be equal to "R"
You need to fetch only the first character