Hi all I have made a mail system for my game, and i get the message from the database like this: "from"."message", and then use String.Split to split up the message from the sender name and then each message from other messages so i use String.Split("."[0]); and String.Split(","[0]); So the problem is that if there is a "," in the message it buggs ofc. so i have tried with other symbols like "*" or "\" but then the String.Split gives me errors. So I just wanted to know if any of you have any ideas of some symbols to use, that are usable and are unusual to use in a message.. Thanks everybody!
If you use a long string that you split, then your options are limited. You could use a special char that works, or an uncommon character like | or a tab, depending on your mail system and disallow such characters. Alternatively, use a serialization method like JSON that doesn't suffer from this problem. Or use a proper table structure for it.
Was doing this a few minutes ago and realised I'd have the same problem with a . in the string. Ended up using a pipe ( this thing | ) instead and it seems to work fine.
pipe worked just fine and i just dont disallow it in messages, along with some other chars. The long string will be just fine for my project. Thanks
"\" is an escape character, so to use it as a literal character you need to use "\\" instead. "*" should work without issues. --Eric
There isn't a wildcard character though outside of regex. I tested "*" and it works fine; "\*" will generate an error because there is no such escape sequence. --Eric