Skip to content
Advertisement

Change all letters except space from a string using Java

I want to change all letters from a string to “-” char except space using Java.

I tried:

JavaScript

and

JavaScript

They didn’t work.

I tried:

JavaScript

It worked but i didn’t change Turkish characters I use in that string.

Original Code:

JavaScript

Advertisement

Answer

You can use the \S regex:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement