Just trim it before you split
" A B # C#D# E # ".trim().split("\\s*#\\s*")
The spaces after the commas in [ A B, C, D, E]
are just the way Arrays.toString
prints
Just trim it before you split
" A B # C#D# E # ".trim().split("\\s*#\\s*")
The spaces after the commas in [ A B, C, D, E]
are just the way Arrays.toString
prints