[10287 views]
Strings are widely used in Java programming language, which are a sequence of characters. The Java platform provides the String class to create and manipulate strings. String is mostly used to store text data.
But String can contain various characters like $, &, @,!,(whitespace),* and many more which when used to perform some Business logic operations can create issues like inserting such String into Database will create issues. So, if you want to remove those unwanted characters, here is a simple program in java which uses regular expresssion to remove unwanted characters.
Thisisasentence
In above Java Program, we have used this regular expression: