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


(This command has been awarded a Yubnub Golden Egg)

ifthen -value1 {strfind -find ${token=@}${token=@} -string %s} -value2 0 -test equal -then {strreplace -find ${token=@} -replace -string %s} -else ${else}
eop - Checks the value between two tokens in a string. If empty, nothing is returned. If not empty, the whole string is returned.

eop [STRING] -else [VALUE IF EMPTY] -token [TOKEN VALUE (Default @)]

eop I like @monkeys@
    (returns "I like monkeys")

eop I like @@
    (returns "")

eop I like @@ -else Hello World!
    (returns "Hello World!")

http://images.google.com/{eop images?q=@%s@}
    (If %s has a value, you are sent to http://images.google.com/images?q=%s, if it has no
      value you are sent to http://images.google.com/)

This command was created to assist in creating commands that go to one location if given a
parameter, and another if empty. It checks between two tokens in a string (default @) for 
any value (typically %s), and returns the whole string (minus tokens) if not empty. If the value
IS empty, nothing is returned (or the value of -else is returned).

You can set the -else parameter to return a string if the value is empty.

By default, the tokens eop looks between are @. This can be changed by setting the -token parameter.

Allen Ormond - aormond (at) gmail (dot) com

Thanks to Stian's unconscious mind for coming up with the idea.
244649 uses - Created 2006-04-02 16:43:25 - Last used 2017-07-24 15:16:08