java - Split string at hyphen characters too -
the line below splits string on (.), (,), (:) , newline (\n) characters.
string[] textphrases = text.split("[.,:\\n]"); i need split on hyphen characters too, not work:
string[] textphrases = text.split("[.,:/-/\\n]"); what missing or doing wrong? thank you.
this regex. hyphen has special meaning inside character class. need place hyphen first or last item in class:
[-.,:\n]
Comments
Post a Comment