我在我的代码中使用 TCPClient,我可以成功地找到字符串中文本的开始和结束。
e.g
Start of Text : <Root>
End of Text : </Root>
但我有另一个字符串,其中包含 STX
在字符串的开头。我如何识别STX
在 C# 中?
最佳答案
STX
只是一个ASCII字符
https://en.wikipedia.org/wiki/ASCII
const char STX = '\u0002';
您可以像使用任何其他角色一样使用它:
String source = ...
bool starts = source.StartsWith(STX.ToString());
bool contains = source.Contains(STX);
关于c# - 如何识别字符串中的 STX 字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37965914/