Strings and formatting#
Strings and conversion#
Quote text with single or double quotes, and escape any quote or backslash inside a string. string, number, boolean, fraction, bignumber, bigint, and typeOf convert or inspect values.
concat("hello ","world")
typeOf(3+4i)
number("12.5")Interactive examples could not load. You can still copy the expressions.
Format and print#
format returns formatted text, with an optional precision: format(pi, 4) returns 3.142. print builds a string from a template and a scope object, substituting $name placeholders, so the sigil is a dollar sign rather than braces. It is not a console print.
print("radius=$r",{r:3})Interactive examples could not load. You can still copy the expressions.
format(pi,4)
format(12345,{notation:"engineering"})
print("radius=$r, area=$a",{r:3,a:9})Interactive examples could not load. You can still copy the expressions.
App-wide notation and precision control how results are displayed. An explicit format or print changes only the text that one expression returns.
Text operations#
concat, compareText, equalText, compareNatural, size, and subset are supported where they apply. Cell indexing starts at 1, so use the reference example when you are selecting characters.
JavaScript string helpers such as upper, lower, trim, startsWith, replace, substring, and indexOf are not built-in cell functions. Do not assume a JavaScript method is callable in a math expression. The complete function reference lists what is available.
Large results#
Truncate output in Math settings limits how much of a result is displayed. Copying a result and exporting source are separate operations: a source export keeps the expressions, not the calculated answers.