79128253

Date: 2024-10-26 10:04:44
Score: 1
Natty:
Report link

1. How to Remove Special Characters and Get Alphabets and Numbers?

String str = "#@F&L^&%U##T#T@#ER###@#@M*(U@&#S%^%2324@*(^&";
String result = str.replaceAll(RegExp('[^A-Za-z0-9]'), '');
print(result); //Output: FLUTTERMUS2324

2. How to Remove Special Characters and Get Alphabets only?

String str1 = "#@F&L^&%U##T#T@#ER###@#@M*(@&#S%^%2324@*(^&";
String result1 = str1.replaceAll(RegExp('[^A-Za-z]'), '');
print(result1); //Output (Allphabets Only): FLUTTERMS 

3. How to Remove Special Characters and Get numbers only?

String str2 = "#@F&L^&%U##T#T@#ER###@#@*(@&#%^%2324@*(^&";
String result2 = str2.replaceAll(RegExp('[^0-9]'), '');
print(result2); //Output (Numbers Only): 2324

4. How to Remove Special Characters and Get numbers only?

String str3 = "#@F&L^&%U##T#T@#ER###@#@*(@&#%^%2324@*(^&";
String result3 = str3.replaceAll(RegExp('[^A-Za-z0-9]'), '.');
print(result3); 
//Output: ..F.L...U..T.T..ER....2324.....
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Looks like a comment (1):
  • High reputation (-1):
Posted by: Kalpesh Khandla