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
System.out.println(LoginToken);
This is generic solution:
str.replaceAll("^.|.$", "")