Text formatting
- Last UpdatedDec 06, 2023
- 1 minute read
This type of assignment operator is only for fields of string type SSTRING, DSTRING, MSTRING.
For more information, see Field data types.
Syntax
Use it to format text with the syntax [*'formattedText',list of params…].
-
Formatted text includes both plain text and formatters, according to the .NET format syntax.
-
Follow the text with a list of comma-separated parameter values. The number depends on the number of formatter placeholder in the formatted text.
-
Use a prefix before each value to explicitly define its nature and use the right formatter.
-
The formatter operator supports nesting.
-
However, even if the syntax is the same as those used for nested assignments, you cannot have nested text formatting.
Text formatting prefixes
These are prefixes for text formatting.
|
Prefix |
Use |
|---|---|
|
n: |
Defines the following value as a number. |
|
d: |
Defines the following value as a date in seconds. |
|
t: |
Defines the following value as a date expressed with a SDATETIME field. |
Code example
This is a code example for text formatting.
text="time: [*'{0:mm:ss}',d:@currentTaskmanager.timeFromStart@]
score: [*'{0:P0}',n:@currentTaskmanager.currentScore@]"
value="[*'{0:000.00}',n:@VG-PI52203.value@]"
the time is: [*'{0:mm:ss}',t:@timerVar.value@]