"dani kotlar" <da*********@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
Is there a function that copies between string (or stringbuilder)
objects, while filtering out certain types or designated characters,
or leaving a certain typa of designates\d characters? For example, I
want to copy only the alphanumeric characters, or I want to copy a
string without the spaces.
To copy a string without the spaces:
string theOriginal = "String with spaces";
string theCopy = theOriginal.Replace(" ","");
With a StringBuilder:
StringBuilder theOriginal = new StringBuilder("Strign with spaces");
theOriginal.Replace(" ", "");
string theCopy = theOriginal.ToString();
To remove "a" and "b" characters:
string theCopy = theOriginal.Replace("a","").Replace("b","");
If the combination of characters that you want to remove gets more
complex than this, it's time to start studying Regular Expressions (RegEx
class).