CalcTree Help Pages
  • What is CalcTree?
  • Getting started
    • CalcTree Pages
    • Create a CalcTree Page
    • Add a calculation
    • Collaborate with a colleague
  • Calculations
    • Parameters
      • Math formulas
        • Parameter Data Types
        • Native Functions
          • Arithmetic Functions
          • Trigonometric Functions
          • Logical & Comparison Functions
          • Matrix & Vector Functions
          • Probability & Combinatorics Functions
          • Statistical Functions
          • String Functions
          • Utility Functions
          • Other Native Functions
        • Valid Expression Syntax
      • Supported Units
      • Dropdown List Parameters
        • Linking CSV Data to Dependent Dropdowns in CalcTree
      • Parameter Settings
    • Integrations
      • Python in CalcTree
        • Adding a Python Source
        • Defining Parameters in Python
        • Referencing Other Parameters in Python
        • Working with Units in Python
        • Creating Tables and Visuals in Python
        • Consuming Files in Python
        • Using Pre-installed Python Libraries
      • Spreadsheets [Coming Soon!]
      • File Upload
        • CSV files
      • 3rd Party Software Plugins
        • Excel
        • Grasshopper
        • ETABS [v20 & v21]
        • ETABS [v22]
        • SAP 2000
        • CSI Bridge [v26]
    • Templates [Coming Soon!]
    • Optimising your calculations
  • Pages & Reports
    • CalcTree Documents
    • Static content
    • Parametric content
      • Parametric equation
      • Inputs
      • Outputs
  • Export to PDF
  • API
    • GraphQL API
      • Generating an API key
      • Queries
        • GetCalculation
        • Calculate
      • Examples
        • Bulk calculations with Python
  • Collaborate
    • Add members
    • Review and approval
    • Add stakeholders
  • Administrate
    • CalcTree Workspace
    • Versioning and Audit trail
  • CalcTree for System Administrators
Powered by GitBook
On this page
  • Formatting & Conversion
  • Typical Engineering Use Cases
  • Notes for CalcTree
  1. Calculations
  2. Parameters
  3. Math formulas
  4. Native Functions

String Functions

CalcTree supports a small but useful set of string formatting and conversion functions. These are most commonly used in:

  • Dynamic report labels

  • Unit formatting

  • Conditional text

  • String-based output templates

Formatting & Conversion

Function
Description
CalcTree Example

format(value [, precision])

Convert a value to string

format(1/3, 3) → "0.333"

print(template, values)

Interpolate values into a string

print("E = {x} MPa", {x: 200}) → "E = 200 MPa"

bin(value)

Convert number to binary string

bin(8) → "0b1000"

hex(value)

Convert number to hexadecimal

hex(255) → "0xff"

oct(value)

Convert number to octal

oct(8) → "0o10"

Typical Engineering Use Cases

Scenario
Usage Example

Add units to calculated values

print("Result = {x} kN", {x: round(result, 1)})

Create table labels dynamically

print("Section {n}", {n: 3})

Format values to fixed decimals

format(stress, 2) → "12.34"

Generate binary/hex representations

hex(255) → "0xff" (e.g. for bit flags)

Notes for CalcTree

  • Use print(...) for multi-value string templates. All placeholders use {key} notation.

  • format(...) does not attach units — it only handles number precision.

  • All string outputs can be used in parameter displays, print blocks, or conditional logic.

PreviousStatistical FunctionsNextUtility Functions

Last updated 1 day ago

📘 Looking for more functions? CalcTree’s expression engine is powered by . For a full list of available functions, visit the . Most functions listed there are supported in CalcTree unless otherwise noted.

MathJS
MathJS Function Reference