Getting Rid of the Nulls
From: Drew (someone_at_hotmail.com)
Date: 04/13/04
- Next message: Cyndnei Cohen: "FillErrorEventHandler"
- Previous message: PerryG: "Re: IIS, SSL and my local machine."
- Next in thread: Andreas Håkansson: "Re: Getting Rid of the Nulls"
- Reply: Andreas Håkansson: "Re: Getting Rid of the Nulls"
- Reply: J.Marsch: "Re: Getting Rid of the Nulls"
- Reply: Jon Skeet [C# MVP]: "Re: Getting Rid of the Nulls"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 13 Apr 2004 10:17:07 -0500
I have been using System.Text.Encoding.Unicode.GetString(byte[],0,72)
to converter a byte array from the registry to a string.
This works, but I end up with a bunch of null characters after
the "good" string data that I need to parse. This is evidenced
by the fact that string.length returns 36 when the actual string
data I need to work with is usually much less.
I tried using String.Trim(null) but this doesn't achieve the desired result.
The only thing I can think of is to convert the string to a char array
and loop through until I hit a null character.
Is there a better way to get rid of the nulls?
If I could just get the actual length of the string that would help.
Thanks,
Drew
- Next message: Cyndnei Cohen: "FillErrorEventHandler"
- Previous message: PerryG: "Re: IIS, SSL and my local machine."
- Next in thread: Andreas Håkansson: "Re: Getting Rid of the Nulls"
- Reply: Andreas Håkansson: "Re: Getting Rid of the Nulls"
- Reply: J.Marsch: "Re: Getting Rid of the Nulls"
- Reply: Jon Skeet [C# MVP]: "Re: Getting Rid of the Nulls"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|