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
I've been coding for the better part now of about 15 years, starting in the good old Turbo Pascal 7 days, when I made my very first computer game ( my own version of Reversi / Othello) and I was hooked, through to Delphi 2009 (and higher, just didn't use it that much).
For the last 3 years or so I have been off and on using C#/ASP.NET (and even more recently Entity Framework and MVC) and I think it is TOTALLY awesome. Having said that though, I must admit that I will always be a Delphi guy at heart. I've dabbled in a few other languages and am always on the lookout to keep in touch with what's new in the software development scene.
When I am not coding, I keep myself busy writing
short stories[
^], partying hard, singing at karaoke (don't judge me!), trying to learn how to play the guitar and generally helping others wherever I can.