Most reliable split character

后端 未结 11 2016
忘掉有多难
忘掉有多难 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:33

    It depends very much on the context in which it's used. If you're talking about a very general delimiting character then I don't think there is a one-size-fits-all answer.

    I find that the ASCII null character '\0' is often a good candidate, or you can go with nitzmahone's idea and use more than one character, then it can be as crazy as you want.

    Alternatively, you can parse the input and escape any instances of your delimiting character.

提交回复
热议问题