M
mp
I posted a ques with this subject an hour ago and it hasn't shown up yet(in
my newsreader), so apologies if it eventually does appear(or has appeared on
your end).
I wrote this function to remove double spaces(and some other unwanted
whitespace) from an input string.
is there a better way?
thanks
mark
private string RemoveExcessWhitespace(string inputString)
{
StringBuilder sb = new StringBuilder();
sb.Append(inputString);
int lastLength = 0;
int thisLength = 0;
do
{
lastLength = sb.Length;
sb.Replace('\t', ' ');
sb.Replace(" ", " ");
sb.Replace(") ", ")");
sb.Replace(" (", "(");
thisLength = sb.Length;
} while (thisLength != lastLength);
return sb.ToString();
}
my newsreader), so apologies if it eventually does appear(or has appeared on
your end).
I wrote this function to remove double spaces(and some other unwanted
whitespace) from an input string.
is there a better way?
thanks
mark
private string RemoveExcessWhitespace(string inputString)
{
StringBuilder sb = new StringBuilder();
sb.Append(inputString);
int lastLength = 0;
int thisLength = 0;
do
{
lastLength = sb.Length;
sb.Replace('\t', ' ');
sb.Replace(" ", " ");
sb.Replace(") ", ")");
sb.Replace(" (", "(");
thisLength = sb.Length;
} while (thisLength != lastLength);
return sb.ToString();
}