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


ifEmpty -value ${new} -then ${orig} -else {strReplace -find + -replace %20 -string {delw -w </i></b> -s {delw -w <b><i> -s ${new}}}}[no url encoding]
        sp2 -new [CORRECTED WORDS] -orig [UNCORRECTED WORDS]

        sp2 -new {sp1 monica beluci} -orig monica beluci
        returns: monica bellucci

        sp2 -new {sp1 internatioal aids confrence} -orig internatioal aids confrence
        returns: international aids conference

        Another building block on the way to spllw and as such it can only be understood in relation to them both. sp1 is a command that scrapes the "did you mean" suggestion from Google, but because it does it for all cases (and not just for one word, as ?> and \\ do) it scrapes the suggestion together with html markup. So, one function of this command is to strip out that markup.

        The other function is more subtle and is an example of a technique for using variables (!) inside Yubnub. But first let's see why we need variables. sp1 has the inconvenient that if you use it with correctly spelled words it returns nothing (i.e. "sp1 correct" returns nothing). This is clearly unacceptable because we would like to use it chained with other commands. The solution is obvious, use ifThen to detect wether "sp1 query" returns something, if it does, return "sp1 query", otherwise, return query. 

        Well, the problem is that I truly hate waste, and that solution is wasteful because YubNub has to process "sp1 query" twice, when it sees whether it's empty and when it returns it. We're not talking femtoseconds here, since Yubnub commands usually require the collaboration of several machines in several geographies we're talking big precious seconds. And that's why I use 3 commands (sp1, sp2, spllw) to do efficiently what could be done wastefully with one command. It's all very simple though, just a tad convoluted.

        sp1, spllw, spll, ?>, \\

4030 uses - Created 2006-01-31 06:58:03 - Last used 2017-05-15 13:09:05
Like this command? Nominate it for a Yubnub Golden Egg
Do you find this command offensive? Let Jon know.