Short: new efun strtrim()
From: Dave Setty <garpoz@locallink.net>
Date: Thu, 10 Dec 1998 02:03:04 -0500
Type: Feature
State: Done - implemented in 3.2.7-dev.127

3) strtrim(), which cuts a specified character (usually spaces) off

Matthew Julius explains:

varargs string strtrim(string, int, int)
  First argument is the string to trim.
  Second argument is the character to trim.
  Third argument is a bit field designating to trim from the right, left,
  or both sides.  Also, a fourth option, perhaps, to filter the character
  from the entire string.
  For examples,
    strtrim("  abc  ", ' ',   1) == "abc  "
    strtrim("  abc  ", ' ', 1|2) == "abc"
    strtrim("  abc  ", ' ',   2) == "  abc"
  The Timewarp mudlib has historically called this trimstr().

alfebtcd comments:

> use regreplace("  bla  ","(^ *)|( *$)","",1) and similar.  i don't like
> the idea of puttin such specialised efuns in the driver when it already
> provides more general ones which handle the problem quite sufficiently.
> you always can make simul_efuns with a better name and a simpler
> interface if you consider regreplace() too complex for normal wizards.

Matthew Julius answers:

Actually, Timewarp has never supported regreplace()...
Ever since the first day we compiled the GD with it and it crashed the GD.
We also had a sefun/efun regsubst() which was more robust than regreplace()
at the time, but it never materialized and now we have neither.  I still
harbor a dislike of regreplace() for some reason though.

Lars comments:

Trimming spaces happens often enough to justify a specialized (aka faster)
efun.

