Home Search

DriveWorks Pro 24
TextFormatInvariant

Send Feedback

TextFormatInvariant

Formats one or more values invariantly according to the given formatting string.

Syntax

TextFormatInvariant(Format string, Collection of [Values])

Where:

Format string The string to format that contains placeholders {0}, {1}, etc. with formats to use (for example "C:\Program Files\{0:0.#}\Hello\World\{1:yyyy-MM-dd hh:mm:ss}").

For more information see Microsoft Learn.

Collection of [Values] The value or collection of values, separated with a comma (,) to be formatted. The first value will be passed into the {0} placeholder, the second value will be passed into the {1} placeholder, etc.

Invariant Culture

The invariant culture is culture-insensitive.

It is particularly important when specifications are run on browsers with different regional cultures.

When text is formatted invariantly the result is consistent across all cultures.

To format text using the regional culture see TextFormat.

Examples

Example 1

TextFormatInvariant("C:\Program Files\{0:0.#}\Hello\World\{1:yyyy-MM-dd}",9.7, Now())

will result in C:\Program Files\9.7\Hello\World\2026-05-24 (when called on that date)

Example 2

TextFormatInvariant("The total price is {0:$#.00}",12345)

will result in The total price is $12345.00.

See Also

For more information on formatting strings please see the Microsoft article Microsoft Learn.

Other functions that use the invariant culture

TextInvariant - Formats the given value according to an Excel formatting string using the invariant culture.

TableFormatInvariant - Formats text found in a column in the provided table using the invariant culture.

Functions that use regional culture

Text - Formats the given value according to an Excel formatting string.

TextFormat - Formats one or more values according to the given formatting string using .NET standard format strings.

TableFormat - Applies a format to all values in a specified column of a table.