913 B

Function print

Interpolate values into a string template.

Syntax

math.print(template, values)
math.print(template, values, precision)

Parameters

Parameter Type Description
template String
values Object
precision Number Number of digits to format numbers. If not provided, the value will not be rounded.

Returns

Type Description
String str

Examples

// the following outputs: 'The value of pi is 3.141592654'
math.format('The value of pi is $pi', {pi: math.pi}, 10);

// the following outputs: 'hello Mary! The date is 2013-03-23'
math.format('Hello $user.name! The date is $date', {
user: {
name: 'Mary',
},
date: new Date().toISOString().substring(0, 10)
});