How to split a String containing multiple groups of string into Sets of Set in Java -


i have string contains multiple groups of string, each group wrapped in brackets {}. each group separated comma , each string group separated comma. format like:

  {abc,  def}, {006,  xy,  036}, {......} 

what want put each group hashset, , hashset contains sets, like:

  set 1:  abc           def    set 2:  006           xy           036    .....   set n:    allsets --> set1, set2, set...., setn. 

what can think of iterate each char in original string , add set(s). wonder if there other ways it, or if java has apis can accomplish this. lot!

    string str="{abc,  def}, {006,  xy,  036}";     pattern p = pattern.compile("\\{(.*?)\\}");     matcher m = p.matcher(str);     while (m.find()) {       system.out.println(m.group(1));     } 

it give values

abc, def
006, xy, 036

now can go ahead , add accordingly string array or map, hack around.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -