Type in a command, or "ls dictionary" to search all commands for "dictionary", etc.

substring

ifthen -value1 ${end} -value2 -test EQUAL -then { ifthen -value1 ${start} -value2 -test EQUAL -then %s -else { strRight %s {sum { strLength %s } -${start} 1 } } } -else { ifthen -value1 ${start} -value2 -test EQUAL -then { strLeft %s ${end}} -else { strRight { strLeft %s ${end} } { sum ${end} -${start} 1 }}}
NAME
     substring - Extract a substring of a given string

SYNOPSIS
     substring [STRING TO PARSE] -start [START POSITION] -end [STOP POSITION]

EXAMPLES
     % substring Hello World -start 2 -end 8
      ==> ello Wo
     
     % substring Hello World -start 4
      ==> lo World
     
     % substring Hello World -end 8
      ==> Hello Wo
     
     % substring Hello World
      ==> Hello World

DESCRIPTION
     Extracts a substring from a provided string.  -start and -end
     are both optional.  Positions are *inclusive* and begin at 1.
     
     The following illustrates the command's course of action:
     
     -start and -end provided
        : return substring from position START to position END
     -start provided, -end not provided
        : return strLeft beginning at position START
     -start not provided, -end provided
        : return strRight terminating at position END
     -start not provided, -end not provided
        : return the string
     
     Positions are *inclusive* and begin at 1.

AUTHOR
     Gershman, David A (gershman@dagertech.net)
     
     Thanks to:
       Jonathan Aquino for YubNub!
       Allen Ormond for 'ifthen', 'sum', 'strLength',
                        'strLeft', and 'strRight'!
       
    
13496 uses - Created 2006-06-27 20:28:27 - Last used 2022-07-21 02:54:24
Is this command broken? Tell Jon if you know how to fix it.
Do you find this command offensive? Let Jon know.