How can i remove special symbols from string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How can i remove special symbols from string?

3rd Mar 2022, 10:08 AM
Влад Пархомец
Влад Пархомец - avatar
2 Answers
+ 7
With java public class RemoveSpecialCharacterExample1 { public static void main(String args[]) { String str= "This#string%contains^special*characters&."; str = str.replaceAll("[^a-zA-Z0-9]", " "); System.out.println(str); } }
4th Mar 2022, 4:57 AM
Vaibhav
Vaibhav - avatar
+ 3
There are ways to do this, and it varies by the programming language used. Add programming language(s) name in the tags to narrow down scope.
3rd Mar 2022, 10:11 AM
Ipang