• function

can.sub

 

Returns a string with {param} replaced values from data.

can.sub("foo {bar}",{bar: "far"}) //-> "foo far"

can.sub(str, data, remove, s)

Parameters

  1. str {String}

    The string to make substitutes on

  2. data {Object}

    The data to be used to look for properties. If it's an array, multiple objects can be used.

  3. remove {Boolean}Optional

    if a match is found, remove the property from the object

  4. s {String}

    The string to replace

Returns

{String}

The converted string or null if any data to render are undefined or null

Returns a string with {param} replaced values from data.

can.sub("foo {bar}",{bar: "far"})
//-> "foo far"