How to remove first and last character of a string?

后端 未结 12 2071
遥遥无期
遥遥无期 2020-12-08 08:56

I have worked in SOAP message to get LoginToken from Webservice, and store the LoginToken in String and used System.out.println(LoginToken); to print. This prin

12条回答
  •  执笔经年
    2020-12-08 09:48

    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 ) );
    

提交回复
热议问题