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

eop

(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}
NAME
eop - Checks the value between two tokens in a string. If empty, nothing is returned. If not empty, the whole string is returned.

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

EXAMPLES
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/)

DESCRIPTION
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.

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

Thanks to Stian's unconscious mind for coming up with the idea.
http://groups.google.com/group/YubNub/browse_thread/thread/abcf3e5852268d85/
    
244652 uses - Created 2006-04-02 16:43:25 - Last used 2023-03-03 11:24:35
Is this command broken? Tell Jon if you know how to fix it.