Most reliable split character

后端 未结 11 1995
忘掉有多难
忘掉有多难 2021-01-31 01:49

Update

If you were forced to use a single char on a split method, which char would be the most reliable?

Definition of reliable: a split charact

11条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 02:41

    It depends what you're splitting.

    In most cases it's best to use split chars that are fairly commonly used, for instance

    value, value, value

    value|value|value

    key=value;key=value;

    key:value;key:value;

    You can use quoted identifiers nicely with commas:

    "value", "value", "value with , inside", "value"

    I tend to use , first, then |, then if I can't use either of them I use the section-break char §

    Note that you can type any ASCII char with ALT+number (on the numeric keypad only), so § is ALT+21

提交回复
热议问题