You are here: Start » Function Reference » String » FormatIntegerToString
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Creates a string from an integer number using a proper format.
Syntax
void avl::FormatIntegerToString ( const int inInteger, const int inDigitCount, const atl::String& inTrailingCharacter, const bool inForceSignPrinting, const atl::String& inSuffix, const int inSystemBase, atl::String& outString )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
inInteger | const int | Input integer | |||
inDigitCount | const int | 0 - 100 | How many characters the output string should have at least | ||
inTrailingCharacter | const String& | \"0\" | Defines the trailing character | ||
inForceSignPrinting | const bool | False | Forces printing the sign of the number even if the number is positive | ||
inSuffix | const String& | \"\" | Defines a suffix. Generally it is an unit of value (eg. mm) | ||
inSystemBase | const int | 2 - 16 | 10 | The base of the numeral system | |
outString | String& | Output string |
Examples
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
Error type | Description |
---|---|
DomainError | inTrailingCharacter has to be a single character in FormatIntegerToString. |
See Also
- FormatDoubleToString – Creates a string from a double number using a proper format.
- FormatRealToString – Creates a string from a real number using a proper format.
- FormatString – Creates a string according to the given format and data.