What is the best character for String.Split?

Disclaimer: I KNOW that in 99% of cases you do not need to "serialize" the data in a concatenated string.

What char you guys use in a well-known situation:

string str = userId +"-"+ userName;

In most cases, I returned to | (pipe), but in some cases, users even do this. What about “unprivileged” characters like ☼ (ALT + 9999)?

+3
source share
3 answers

It depends on too many factors to give a specific answer.

First, why are you doing this? If you feel the need to store userIdand userName, combining them in this way, consider alternative approaches, for example. CSV style citation or similar.

-, , . userId - , "-" ... , ?

-, , . - , , . , , , , userId userName. , \0, . - (.. ), , . , , - , userId , userName.

+6

, . - - :

  • - -
  • a -, - -0.
  • --

userid = "alpha-dog" userName = "papa--0bear"

alpha-0dog--papa-0-00bear

, , , .

, .

+4

All Articles