Overclock.net banner

Java StringTokenizer

1327 Views 2 Replies 2 Participants Last post by  Nuxes
I'm writing a program that strips a string of all punctuation and spaces, example:

original: "Hello, my name is Nuxes", he said.
new: HellomynameisNuxeshesaid

I know you set the delimiters like this:

StringTokenizer(instring," ,.!?'")

But how would you use a double quotation mark (") as a delimiter? It gets confused if you throw one in with the rest of the punctuation marks, thinking that this is the end of the delimiters, and ending up with one too many ".
1 - 3 of 3 Posts
Put a slash before it: \\"

StringTokenizer(instring," ,.!?'\\"")
  • Rep+
Reactions: 1
Quote:


Originally Posted by Kuntz
View Post

Put a slash before it: \\"

StringTokenizer(instring," ,.!?'\\"")

Thank you! rep+
See less See more
1 - 3 of 3 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top