Str Function

TestStand 2019 Help

Edition Date: May 2019

Part Number: 370052AA-01

»View Product Info
Download Help (Windows Only)

Syntax

String Str(AnyType value, [String formatString], Number decimalPointOption = 1, Boolean useValueFormatIfDefined = False, [String separator])

Return Value

String

A string representation of the property value.
Note: Place a $ character after the % character in the format string to remove trailing zeros after the decimal point.
Note: If you pass a "%s" style format specifier for parameter 2, the first parameter must be a string instead of a number. This allows you to format strings as well as numbers. For example: Str("Right justified", "%40s") evaluates to:
    " Right justified"
Note: If you pass an array value to parameter one, the function returns a string composed of the concatenated values of the array elements.
Note: Use a format code of %b to format a number in binary.
Note: Use a format code of %expr to format an expression for display. The expression must be a localized expression. Specify combinations of the following values for parameter 3 to control how the expression is formatted:
   0x1 - Format precondition-style expressions into a simpler format.
   0x2 - Insert step name comments for expressions that use unique step Ids.
   0x4 - Use shorthand for RunState.Sequence.<StepGroup>["step"] in expression.
   0x8 - Replace unique step Ids with step names.

Purpose

This function formats a property value to a string.

Parameters

value as AnyType

A property to format.

formatString as String

An optional string that specifies a C (printf) style format string to control the conversion. The default is "%$.13g" for numeric values.

decimalPointOption as Number

An optional number that specifies how the function determines which character to use as the localized decimal point. The valid values are:
     1 - (default) Use the Station Options localization preferences to determine whether to use the operating system setting.
     2 - Use the operating system setting.
     3 - Use the period character.
     4 - Use the comma character.

useValueFormatIfDefined as Boolean

An optional Boolean that specifies whether the function uses the inherent format of the first argument if the argument value has a non-default numeric display format. The default is false. If you pass true and the value argument has a non-default format, the function uses the value format instead of the format you pass to parameter 2.

separator as String

An optional string that separates each element in the concatenated string of array elements that the function returns when the first argument is an array.

WAS THIS ARTICLE HELPFUL?

Not Helpful