I have a StringBuilder object that needs to be trimmed (i.e. all whitespace chars /u0020 and below removed from either end).
I can\'t seem to find a method in string
only one of you have taken into account that when you convert the String builder to a "string" and then "trim" that you create an immutable object twice that has to be garbage collected, so the total allocation is:
So whilst it may "appear" that the trim is faster, in the real world and with a loaded memory scheme it will in fact be worse.