Forgive me for sounding a little pedantic, but wouldn't you be able to use the LTrim
and RTrim
functions within the Trim
function? (You'll have to forgive my syntax, I'm more of a Delphi guy myself). "Re-writing" the same code in separate places tends to cause issues when you need to update it, or at least that's what I've found when working on my code
.
public static StringBuilder Trim(this StringBuilder sb)
{
sb = LTrim(sb);
sb = RTrim(sb);
return sb;
}
Thanks,
Glen Vlotman