CustomNumberFormat Class
CustomNumberFormat Members
Defines how number formats are formatted and displayed for the current user.
Constructors
| Name | Description | |
|
|
CustomNumberFormat | This class contains methods to set custom conventions for numbers. |
Methods
| Name | Description | |
|
|
ChangeDecimalSymbol(string) | String used as the decimal symbol (radix). The maximum number of characters allowed for this string is 3. |
|
|
ChangeNumberOfDigitsAfterDecimal(NumberOfDecimalDigits) | Number of fractional digits placed after the decimal separator. |
|
|
ChangeDigitGroupingSymbol(string) | |
|
|
ChangeDigitGrouping(string) | Sizes for each group of
digits to the left of the decimal. An explicit size is
needed for each group, and sizes are separated by
semicolons. If the last value is 0, the preceding value is
repeated. For example, to group thousands, specify 3;0.
Indic locales group the first thousand and then group by
hundreds. For example, 12,34,56,789 is represented by 3;2;0.
The maximum number of characters allowed for this string is
9. (See Locale Information Constants) |
|
|
ChangeNegativeSignSymbol(string) | String value for the negative sign, for example, "-" for the English (United States) locale. The maximum number of characters allowed for this string is 4. |
|
|
ChangeNegativeNumberFormat(NegativeNumberFormat) | Negative number mode, that is, the format for a negative number. |
|
|
ChangeDisplayLeadingZeros(bool) | Specifies leading zeros in decimal fields. |
|
|
ChangeMeasurementSystem(MeasurementSystem) | System of measurement. Metric or U.S. |
|
|
ChangeUseNativeDigits(NativeDigits) | The shape of digits. For example, Arabic, Thai, and Indic digits have classical shapes different from European digits. |
Enumerations
| Name | Description | |
| NumberOfDecimalDigits | One through Nine. | |
| NegativeNumberFormat | NumberInParenthesis NegativeSymbolProceedsNumber NegativeSymbolSpaceNumber NumberProceedsNegativeSymbol NumberSpaceNegativeSymbol |
|
| MeasurementSystem | Metric or US | |
| NativeDigits | Context. Digits are
displayed based on the previous text in the same output.
European digits follow Latin scripts, Arabic-Indic digits
follow Arabic text, and other national digits follow text
written in various other scripts. When there is no preceding
text, the locale and the displayed reading order determine
digit substitution. Never. No substitution used. Full Unicode compatibility National. Native digit substitution. National shapes are displayed |
Remarks
These methods customize the number formats on the Regional and Language control panel Number property sheet shown below.

Example
| namespace CustomizeNumberSettingsExampleScript { using System; using TestingMentor.TestTool.GlobalTester; class MyTest { static void Main() { try { CustomNumberFormat myNumberFormat = new CustomNumberFormat(); string newNegativeSymbol = "NEG"; if (myNumberFormat.ChangeNegativeSymbol(newNegativeSymbol)) { // Launch AUT // Execute test // Oracle } else { // Negative symbol not changed } } catch(ArgumentOutOfRange e) { // Test script failure - (e.g. negative symbol string argument out of range) } finally { // Log test results } } } } |
This example changes the negative symbol for numbers.
Reference
Also See
CustomLocation Class
CustomCurrencyFormat Class
CustomDateFormat Class
CustomTimeFormat Class





