Java Pattern Matcher single or multiple with comma separated -
i have string, need parse, want use pattern matcher need pattern.
if string below:
sometext : test1,test2 output should be:
test1
test2
if input string :
sometext : test1 then output should :
test1 as can see, can multiple or single.
so, need replace , space? suggest simple
string output = sometext.replace(",", " "); if need newline after first word, can
string output = sometext.replace(",", system.getproperty("line.separator")); instead.
if "sometext : " included in input, can rid of first in same way:
string output = input.replace("sometext : ", "").replace(",", " ");
Comments
Post a Comment