How to remove first and last character of a string?

后端 未结 12 2072
遥遥无期
遥遥无期 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:40

    this is perfectly working fine

    String str = "[wdsd34svdf]";
    //String str1 = str.replace("[","").replace("]", "");
    String str1 = str.replaceAll("[^a-zA-Z0-9]", "");
    System.out.println(str1);
    
    
    String strr = "[wdsd(340) svdf]";
    String strr1 = str.replaceAll("[^a-zA-Z0-9]", "");
    System.out.println(strr1);
    

提交回复
热议问题