Need to trim a string till end after a particular combination of characters

Posted by bits on Stack Overflow See other posts from Stack Overflow or by bits
Published on 2010-06-07T21:48:11Z Indexed on 2010/06/07 21:52 UTC
Read the original article Hit count: 450

Filed under:
|
|

Hi all,

I need help in trimming everything in my string till end after it encounters the first "\0"

So:

"test\1\2\3\0\0\0\0\0\0\0\0\0_asdfgh_qwerty_blah_blah_blah"

becomes

"test\1\2\3"

I am using c#. Help would be greatly appreciated.

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about string