Java – removes spaces and special characters from the string
                                        
                    •
                    Android                                    
                How do I format string phone numbers to remove special characters and spaces?
The format of the number is as follows (123) 123 1111
I want it to look like this: 1231231111
So far, I have this:
phone = phone.replaceAll("\\s","");
phone = phone.replaceAll("(","");
The first line removes spaces. Then I can't remove parentheses. Android studio emphasizes "(" and throws an error without closing the group
resolvent:
You can delete everything except numbers:
phone = phone.replaceAll("[^0-9]","");
                
                            The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
                        
                                            
                        THE END
                    
                    
                    
                                                        二维码
                        
                        
                                                
                        