开发者

Using hex as delimitor when splitting string

I am reading a string of a socket. The sting contains key-value pairs using the hex 0x0开发者_开发技巧1 as delimitor. I would like to split the string to get the pairs, but can't quite get my head around it.

Any help would be greatly appreciated.

.NET/C#. Framework 4.


Given a string input, you can split it using the Split method:

string[] splitted = input.Split(new char[] { (char)0x01});

You might want to use StringSplitOptions.RemoveEmptyEntries as well to remove any elements not containing any readable char.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜