你好,我想从一个字符串中删除所有特定字符的。 我一直在使用String.Replace
,但不起任何作用,我不知道为什么。 这是我当前的代码。
public string color;
public string Gamertag2;
private void imcbxColor_SelectedIndexChanged(object sender, EventArgs e)
{
uint num;
XboxManager manager = new XboxManagerClass();
XboxConsole console = manager.OpenConsole(cbxConsole.Text);
byte[] Gamertag = new byte[32];
console.DebugTarget.GetMemory(0x8394a25c, 32, Gamertag, out num);
Gamertag2 = Encoding.ASCII.GetString(Gamertag);
if (Gamertag2.Contains("^"))
{
Gamertag2.Replace("^" + 1, "");
}
color = "^" + imcbxColor.SelectedIndex.ToString() + Gamertag2;
byte[] gtColor = Encoding.ASCII.GetBytes(color);
Array.Resize<byte>(ref gtColor, gtColor.Length + 1);
console.DebugTarget.SetMemory(0x8394a25c, (uint)gtColor.Length, gtColor, out num);
}
它基本上检索从我的Xbox 360的字符串的字节值,然后将其转换成字符串形式。 但我想它删除的“^”所有实例String.Replace
似乎并没有工作。 它也绝对没有什么。 它只是离开琴弦,因为它以前。 任何人都可以请向我解释,为什么它这样做?