in JAVA by
Q:
How to remove special characters from a string in java?

▼ Show 1 Answer

0 votes
by

How to remove special characters from a string in java?

class New  

{  

public static void main(String args[])   

{  

String str= ""This#string%contains^special*characters&."";   

str = str.replaceAll(""[^a-zA-Z0-9]"", "" "");  

System.out.println(str);  

}  

}  

🔗Reference : stackoverflow.com

🔗Source: Java Interview Questions and Answers

🔗Reference: Javatpoint.com

JAVA
Learn More with Madanswer

Related questions

+1 vote
asked Mar 9, 2020 in Spark Sql by SakshiSharma
...