int stxval = 0x02; //found this value on wikipedia
string mystring = "Hello";

StringBuilder builder = new StringBuilder(mystring);
builder.Append(stxval);

这里在字符串生成器中附加了"2Hello"。如何在“hello”表单中获取字符串?

最佳答案

改为使用char

char stx = '\u0002';


char stx = (char) 2;

就我个人而言,我更喜欢第一种选择,但这取决于你。
不管怎样,那就用:
StringBuilder builder = new StringBuilder(mystring);
builder.Append(stx);

10-04 18:36