Kirrily Robert wrote:
>
> Ricki writes:
> > The following module was proposed for inclusion in the Module List:
> >
> > modid: String::Trim
>
> How on earth is this worth writing a whole module for? Surely it's a
> single line of Perl to do what this module would do?
>
One reason could be speed.
That's why Brent Powers has long time ago written a similar module:
String::Strip
Let's look to it's description:
DESCRIPTION
StripLTSpace - Removes Leading and Trailing spaces from given string
StripTSpace - Removes Trailing spaces from given string
StripLSpace - Removes Leading spaces from given string
StripSpace - Removes all spaces from given string
I do these things often, and these routines tend to be about 35%
faster than the corresponding regex methods.
It seems, that String::Strip has all trim functions,
used in many languages.
I don't understand why we need an extra module String::Trim.
Greetings,
Andrea