[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strim(s)                     trim characters

    Return string formed by trimming  leading and tailing white space  from
    string s. Leading white space matches the regular expression, /^{_w}+/.
    Tailing white space matches the regular expression, /{_w}+$/

strim(s,le)                  trim characters

    Return string formed by trimming string matching le from s AND  tailing
    white space.   'le'  may be  a regular  expression, a  string, a single
    character or a numeric.  Differing actions are taken depending the type
    of le:

                -
    le type     |  action
    ------------+------------------------------------------------
    regular     |
    expression  |  delete  first string  matching  regular  expression
                |
    string      |  convert to  regular expression  and delete  first
                |  matching string
                |
    single      |
    character   | delete  all leading characters  equal to 'le'
                |
    non-zero    |
    numeric     | delete leading white space matching /^{_w}+/
                |
    zero        |
    numeric     | ignore
                -

    strim(s,TRUE) is equivalent to the form strim(s)

    The following all delete the leading dashes from the given string:

    strim("------ remove leading -------",/^-+/);
    strim("------ remove leading -------",/-+/);
    strim("------ remove leading -------",'-');
        ==> "remove leading -------"

strim(s,le,te)               trim characters

    Return string formed by trimming string matching le and string matching
    te from  s. 'le'  and 'te'  may be  a regular  expression, a  string, a
    single character or a numeric.   Differing actions are taken  depending
    the type of le and te:

                -
    le/te type  |  action
    ------------+------------------------------------------------
    regular     |
    expression  |  delete  first string  matching  regular  expression
                |
    string      |  convert to  regular expression  and delete  first
                |  matching string
                |
    single      |
    character   | delete  all leading/tailing characters  equal to
                | 'le'/'te' respectively
                |
    non-zero    |
    numeric     | delete leading/tailing white space matching /^{_w}+/
                | or /{_w}+$/ respectively
                |
    zero        |
    numeric     | ignore
                -

    strim(s,TRUE,TRUE) is equivalent to the form strim(s)


    strim("======remove leading and tailing-------",'=','-')
    or
    strim("======remove leading and tailing-------",/^=+/,'-')
    or
    strim("======remove leading and tailing-------",'+',/-+$/)
    or
    strim("======remove leading and tailing-------",/^=+/,/-+$/)
      ==> "remove leading and tailing"

    strim("======remove leading-------",'=',FALSE)
      ==> "remove leading-------"

    strim("======remove tailing-------",FALSE,'-')
      ==> "======remove tailing"

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson