android - Java doesn't work with regex \s, says: invalid escape sequence -


I want to replace all the spacing characters with "ss" with one "+" and all "ß". It works well for "ß", but somehow eclipse will not let me use \ s for a white space. I tried "\ t" instead, but it does not work either .. I get the following error:

Invalid save sequence (valid ones are \ b \ t \ n \ f \ r \ "\ '\)

< P> This is my code:

  Try {string temp1 = from.getText (). ToString (); start_from = temp1.replaceAll ("ß", "ss"); start_from = start_from .replaceAll ("\ s", "+ +  

Thanks in advance!

Why does not this work? Is it Android, Eclipse or what?

Thanks in advance!

You need to avoid slash

  start_from = start_from.replaceAll (" \\ s "," + ");  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -