The merge function is awesome!

Geoff Canyon gcanyon at gmail.com
Fri Jan 18 13:57:27 EST 2019


On Fri, Jan 18, 2019 at 3:23 AM Mark Waddingham via use-livecode <
use-livecode at lists.runrev.com> wrote:

> On 2019-01-18 06:48, Geoff Canyon via use-livecode wrote:
> > I was in the same position with merge(). If you haven't seen it
> > already,
> > format() has some pretty amazing capabilities as well.
>
> To answer your question about escaping - yes there is:
>
>    [[[]] -> [
>    [[]]] -> ]
>

Ha, so my string ends up as:

[[the name of tID]] - [[[]][[the id of tID]][[]]]

That's a lot of square brackets!


> Also the merge function has another feature (which I think was actually
> undocumented for a long time - although, for once, it is there now!):
>
>    1) "[[ 1 + 2 ]]" -> 3 (function / expression evaluation)
>    2) "<? if 1 + 2 is 3 then return true else return false ?>" ->
> (command / statement evaluation)
>
> Basically (1) does the equivalent of 'value()' on the string enclosed in
> [[ / ]]; whilst (2) does the equivalent of 'do <script>' on the string
> enclosed in <? and ?>.
>

(2) is not documented well at all. I had to go to
http://newsletters.livecode.com/august/issue55/newsletter2.php to figure it
out.



More information about the Use-livecode mailing list