Saturday, 15 September 2012

Replace special character with double quotes

public class Sample {
    public static void main(String[] args) {
String test = "«myname»";
System.out.println(test);
System.out.println(test.replace("«", "\"").replace("»", "\""));
System.out.println();
    }

}
output:
«myname»
"myname"

No comments:

Post a Comment

Pass a HashMap from Angular Client to Spring boot API

This example is for the case where fileData is very huge and in json format   let map = new Map<string, string>()      map.set(this.ge...