I have to do validation to check user entered answer to an application. I want to remove spaces (if any) left or before for bellow special characters.
- /
- ,
- :
- ;
- -
- .
So the final output should be like this.
Ex:
Correct answer => a/b
Answers need to accept => ' a/b ', 'a/ b', 'a /b', 'a/ b ', 'a/b '
I can do this using replacingOccurrences function by replacing all possible values. Is there any better solution for this?