I have a requirement in which I need to remove the semicolon if it is present at the end of the String(only at the end). I have tried the following code. But still it is not
You are using the wrong version of String.substring, You could use:
String.substring
text.substring(0, text.length() - 1)