1 of 1 found this page helpful

% String Interpolation Operator

    Table of contents
    1. 1. Usage Restrictions
    2. 2. Samples

     

    Interpolates values from a Map or a list. into a string. each value in the map is accessible for Interpolation by the keyname preceded by $. With a List the variables are numbers in order. E.g $0 $1 $2 . Not to be confused with the Modulus % Operator

    Usage Restrictions

    9.02 or later.

    Samples

      Output

    Expands the one key place into the string.

    {{ "hello $place " % { place: "world" } ; }}

    hello world

     

    Expands multiple key values into a string from a map.

    {{ var mymap = { name : "john" , age : 20, favcolor : "red"}; 
    "$name is $age" % mymap; }}
    john is 20

    Expands based on a list

    {{ "the $0 is $1" % ["date",date.now ]; }}
    the date is Fri, 24 May 2013 08:57:40 GMT
    Was this page helpful?
    Tag page
    Viewing 3 of 3 comments: view all
    which version was this introduced with?
    Posted 22:24, 11 Jun 2010
    @klumsy i believe it was 9.02. also note that this works too: "$0 $1" % [ "hello", "world" ]
    Posted 01:38, 12 Jun 2010
    where would this fit in the operator precedence scale?
    Posted 19:58, 12 Jun 2010
    Viewing 3 of 3 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by