Remove Punctuations from String Java
PROGRAM TO REMOVE PUNCTUATIONS FROM A STRING
OUTPUT
Welcome to TransGeek
public
class
Test
{
public
static
void
main(String[] args)
{
// input string
String str =
"Welcome???@@##$ to#$% Trans$%^&Geek"
;
// similar to Matcher.replaceAll
str = str.replaceAll(
"\\p{Punct}"
,
""
);
System.out.println(str);
}
}
Welcome to TransGeek
Hii
ReplyDelete