Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

How to remove NULL byte from String in C#

, 29 Mar 2010 CPOL
string result = input.Replace("\0", string.Empty);However, as you have already been told, using Unicode UTF16 is a bad idea. If you really need Unicode, you should use UTF8 instead.

Revisions


  

Compare Revision Minor Date Status Editor
2 - publicly available No 29-Mar-10 10:51 Available Toli Cuturicu
1 No 29-Mar-10 10:49 Composing Toli Cuturicu

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Toli Cuturicu
Software Developer
Romania Romania
I started programming a ZX Spectrum in 1985 using Spectrum Basic (arghh) and Z80 assembler.
I switched to pascal and 80286 assembler in 1992.
From about 1999 I began using Delphi.
Pascal and Delphi will always remain close to my soul.
I learned a little C and C++ for my linux machine, but always hated it!
I graduated Chemistry in 1997 (Master in 1999) but I never used it.
I had to learn C# and SQL when I first got employed in IT in 2005 and I do not regret it.
I like C# a lot and I do warmly recommend it.
 
I use Windows 7 and Windows XP, Internet Explorer 9, Visual Studio 2005 and 2010, Paint.NET, Firebird SQL etc.
 
I am currently mainly programming Windows Applications in C# using Windows Forms.
 
I am Romanian and I live in Romania, but I visited lots of countries and learned many foreign languages.
 
I want to know stuff so I read a lot.
I like to ski and to play table tennis.
I play decent chess, backgammon, bridge and many other games. And, since I like board and card games, I also like to program them, of course.
I like to program for fun and I have lots of projects and not enough time to pursue them.
 
More? I don't think so. If you've got so far you are probably already bored.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150326.1 | Last Updated 29 Mar 2010
Article Copyright 2010 by Toli Cuturicu
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid