java - How to use StringTokenizer properly -
how should use stringtokenizer
when delimiters appear consecutively several times, stringtokenizer
recognize empty space between them empty string , print empty line?
alternatively, how can use string.split()
method takes several characters delimiters , same job?
for example string "abcd;,;ef,,gh"
should printed as:
abcd # empty line here # empty line here ef # empty line here gh
as per input
"abcd;,;ef,,gh"
output:
abcd # empty line here # empty line here ef # empty line here gh
why there 2 "empty line here" , when there ;,; ?
maybe can replace "delimiters" whitespaces, tokenize print each string foreach, , inside loop print whitespace or "empty line here" ?
Comments
Post a Comment