Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Use Formatters to apply logic to strings

Browse the formatters that convert a selected value into text in a Smart String.
Read time 1 minuteLast updated 12 days ago

Browse the formatters that convert a selected value into text in a Smart String.
A formatter converts the value produced by the sources into its final text, applying logic such as pluralization, lists, or conditional output. Apply a formatter explicitly by name, or omit the name to let a formatter that supports automatic detection apply implicitly. The following formatters are available, and you can add your own.

Formatter

Description

Choose formatterPicks an output by matching the value against a set of options.
Conditional formatterPicks an output based on the value's type and value.
Default formatterConverts the value with
ToString
and the active culture.
Is Match formatterPicks an output based on a regular expression match.
List formatterFormats each item in a list, with separators.
Null formatterPicks an output based on whether the value is null.
Plural formatterPicks a word form based on a count and the culture's plural rules.
Sub string formatterExtracts a substring of the value.
Template formatterApplies a reusable named template.
Time formatterFormats a
TimeSpan
as localized text.
Create a custom formatterWrite your own formatter.

Additional resources