Gaurav Mehra
Gaurav Mehra

Reputation: 23

String replaceAll hyphen not working java 8

String test = "Vol. 5 −";
        test = test.replaceAll("\u2014", "");
        test = test.replaceAll("//-", "");
        test = test.replaceAll("-","");
        System.out.println(test);

Still got "Vol. 5 -" in output tried in all possibilities

Upvotes: 1

Views: 1885

Answers (1)

Thomas Banderas
Thomas Banderas

Reputation: 1739

    String test = "Vol. 5 −";
    test = test.replaceAll("\u2212", "");
    System.out.println(test);

Works fine

Upvotes: 2

Related Questions