Replace dash character in Java String

java, replace, str-replace, string

Solution

String is Immutable in Java. You have to reassign it to get the result back:

String str ="your string with dashesh";
str= str.replace("\u2014", "");

See the API for details.

Problem

I tried to replace "-" character in a Java String but is doesn't work : ``` str.replace("\u2014", ""); ``` Could you help me ?

Original source

Related problems