我有一个C#字符串"RIP-1234-STOP\0\0\0\b\0\0\0 ??? | B?Mp?\ 0\0\0"从调用本机驱动程序返回.
如何从第一个空终止符'\ 0 \开始修剪所有字符.在这种情况下,我只想拥有"RIP-1234-STOP".
谢谢.
aar*_*onb 11
这是一个应该做的伎俩的方法
string TrimFromZero(string input)
{
int index= input.IndexOf('\0');
if(index < 0)
return input;
return input.Substring(0,index);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1924 次 |
| 最近记录: |