Start » Filter Reference » Basic » String » FormatIntegerToString

FormatIntegerToString


Module: FoundationLite

Creates a string from an integer number using a proper format.

Applications

Useful for preparing a number for display or communication with specific number of digits, sign etc.
Name Type Range Description
Input value
inInteger Integer Input integer
Input value
inDigitCount Integer 0 - 100 How many characters the output string should have at least
Input value
inTrailingCharacter String Defines the trailing character
Input value
inForceSignPrinting Bool Forces printing the sign of the number even if the number is positive
Input value
inSuffix String Defines a suffix. Generally it is an unit of value (e.g. mm)
Input value
inSystemBase Integer 2 - 16 The base of the numeral system
Output value
outString String Output string

Examples

Description of usage of this filter can be found in examples and tutorial: IO Serial Port Communicator.
inInteger = 200
inDigitCount = 4
inTrailingCharacter = "0"
inForceSignPrinting = False
inSuffix = ""
inSystemBase = 16
outString = "00C8"

In the above example the input value is 200. Formatting is configured for displaying 4-digit hexadecimal number by setting the inDigitCount input. The value of 200 expressed in hexadecimal numeral system is represented as 0xC8. The final result is filled in with zeros.

inInteger = 25
inDigitCount = 4
inTrailingCharacter = "-"
inForceSignPrinting = False
inSuffix = ""
inSystemBase = 10
outString = "--25"

The next example shows you how final representation of a number can be filled with arbitrary chosen sign. First two characters are dashes as defined in inTrailingCharacter.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError inTrailingCharacter has to be a single character in FormatIntegerToString.

Complexity Level

This filter is available on Basic Complexity Level.

See Also

  • FormatString – Creates a string according to the given format and data.