I must to use .NET 2.0 and I have no Linq support here, also...
I've tried to trim chars using Remove() and Trim() functions like:
string guid = Guid.NewGuid().ToString();
string result = header.Trim( new Char[] { ' ', '-'} ));
But for the Trim()
sample, the result is the same as string guid
( they are just equal ).
I've done such function, but I want to use correctly functions from the sealed String class
.
string guid = Guid.NewGuid().ToString();
string result = String.Empty;
for (int i = 0; i < guid.Length; i++)
{
if (guid[i] != '-') result += guid[i];
}
But it looks like plain C style and I want to use exactly String function. Where did I fail with Trim() and Remove().
Don't forget, that I can't use Linq or higher version of .net 2.0, so the question is on the lower level...