SetDigit Function | ![X#](../icons/logo100.jpg) |
Return and optionally change the setting that determines the number of digits that will be shown to the left of the decimal point when a number is displayed.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION SetDigit() AS DWORD
public static uint SetDigit()
Request Example
View SourceReturn Value
Type:
DWord
If
nNewSetting is not specified, SetDigit() returns the current setting.
If
nNewSetting is specified, the previous setting is returned.
Remarks
SetDigit() and SetDigitFixed() can be used together to control the way digits are displayed:
When SetDigitFixed() is TRUE, display of numeric output is fixed according to the SetDigit() value.
When SetDigitFixed() is FALSE, numeric output displays according to the default rules for numeric display.
To provide finer control of numeric display, you can use the PICTURE clause of @...SAY, @...GET, and the Transform() function.
A -1 for
nNewSetting implies that only significant whole digits to the left of the decimal are to be displayed (any leading zeros will be suppressed.)
Tip |
---|
SetDigit() affects only the display format of numbers, not the actual numeric precision of calculations.
|
Examples
This example shows typical uses of SetDigit():
1FUNCTION Start()
2 LOCAL nSaveDigit AS SHORTINT
3 ? 1234
4
5
6
7 nSaveDigit := SetDigit(5)
8 ? 1234
9 ? 1234.567
10 ? 123456
11 SetDigit(nSaveDigit)
12 ? 1234
13 RETURN TRUE
See Also