Mark Bosley <bo*********@hotmail.com> wrote:
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);
}
}
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too