Mark Bosley said:
i'm reading from a database and found special character showing up as \0
or
when i serialize to xml.
trim does not work and using the string.Replace doesn't either.
how do i remove these?
Trim should work just fine, as should string.Replace - could you give a
short but complete example of them not working? Here's one showing them
working:
using System;
public class Test
{
static void Main ()
{
string original = "hello\0 there\0\0\0";
string trimmed = original.Trim ('\0');
string replaced = original.Replace ("\0", "");
Console.WriteLine (original.Length);
Console.WriteLine (trimmed.Length);
Console.WriteLine (replaced.Length);
}
}