Java: splitting a comma-separated string but ignoring commas in quotes

前端 未结 11 1564
广开言路
广开言路 2020-11-21 05:16

I have a string vaguely like this:

foo,bar,c;qual=\"baz,blurb\",d;junk=\"quux,syzygy\"

that I want to split by commas -- but I need to igno

11条回答
  •  清酒与你
    2020-11-21 06:05

    what about a one-liner using String.split()?

    String s = "foo,bar,c;qual=\"baz,blurb\",d;junk=\"quux,syzygy\"";
    String[] split = s.split( "(?

提交回复
热议问题