-1

I get random Strings as input and all I want is to get the ENGLISH words for keyword search app apart from the punctuation marks (see punctuation) or word dividers ( say, white space, multi-white spaces ). This issue is that I won't know the basis for spiting the Strings. For example, if I get a String "FLORENCE - FIRE/TOMORROW", I would like to get String array as {"FLORENCE", "FIRE", "TOMORROW" }. Besides, sometimes it also happen that a single word will come, say, "MELBOURNE" and just need to get the array as {"MELBOURNE"}. Capital letters has nothing to do with the question.

How can I do this ?

Monica Hübner
  • 269
  • 1
  • 4
  • 16
  • if your using java you should look into either the `string.split()` method or the `stringTokenizer` class – TheQAGuy Dec 18 '15 at 01:46

1 Answers1

1
"FLORENCE - FIRE/TOMORROW".split("\\s+-\\s+|/")

use split or with your delimiters.

chengpohi
  • 14,064
  • 1
  • 24
  • 42