How to remove first and last character of a string?
It's easy, You need to find index of [ and ] then substring. (Here [ is always at start and ] is at end) ,
String loginToken = "[wdsd34svdf]";
System.out.println( loginToken.substring( 1, loginToken.length() - 1 ) );
This is generic solution:
str.replaceAll("^.|.$", "")
You can always use substring
:
String loginToken = getName().toString();
loginToken = loginToken.substring(1, loginToken.length() - 1);