i have a string and i need a utility method which looks for bad character presence in the string and return some flag on that. Thanks for help in advance
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use regular expressions to define what characters do you want to appear in a string. If something else appears, report it somehow.
Simple example:
Or from the other side: define your “bad” characters and fire alert if they appear.
More info on regular expressions in Java: http://www.vogella.com/articles/JavaRegularExpressions/article.html