Hello I am trying to remove all of a specific character from a string. I have been using String.Replace
, BUT IT DOES NOTHING and I don't know why. This is my current code.
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);
}
It basically retrieves the byte value of a string from my Xbox 360, then converts it into string form. but I want it to remove all instances of "^" String.Replace
doesn't seem to work. It does absolutely nothing. It just leaves the string as it was before. Can anyone please explain to me as to why it does this?