SETNLS

SETNLS

Top  Previous  Next

 

The SETNLS statement sets the value of a national language support parameter.

 

 

Format

 

SETNLS key,  value

 

where

 

keyidentifies the parameter to be set.

 

valueis the new value for the parameter.

 

 

The SETNLS statement sets the value of the named national language support parameter. NLS parameter name tokens are defined in the KEYS.H include record.

 

Available parameters are:

 

Parameter

Key

Meaning

1

NLS$CURRENCY

Default currency symbol. Maximum 8 characters.

2

NLS$THOUSANDS

Default thousands separator character.

3

NLS$DECIMAL

Default decimal separator character.

4

NLS$IMPLICIT.DECIMAL

Default decimal separator character for implicit conversions. See below.

 

 

Setting two or more of the national language support parameters to the same character will have undefined effects.

 

When using a decimal separator other than the default period, conversion of a numeric character string to a number will recognise either the defined character or a period as being the decimal separator.

 

Numeric constants in QMBasic programs are not affected by the setting of the decimal separator character and must always be written using periods.

 

 

The NLS$DECIMAL setting determines the default decimal separator character to be used when converting numeric values between their internal storage form and their external character form using FMT(), ICONV() or OCONV(). The NLS$IMPLICIT.DECIMAL setting determines the decimal separator character that will be used by implicit conversion of a numeric value to its external character representation in other ways such as simply referencing a floating point variable in a DISPLAY statement.

 

In most applications, these two representations of the decimal separator will be the same and hence setting the NLS$DECIMAL value also sets the NLS$IMPLICIT.DECIMAL value. Sometimes an application may want to use, for example, the comma as the decimal separator in reports and most program output but the period as the decimal separator in implicit conversions such as that done by the INPUT statement, perhaps to allow validation against a pattern template such as "1-3N.2N". Setting the NLS$IMPLICIT.DECIMAL value allows this. Note that this must be set after the NLS$DECIMAL value.

 

 

Examples

 

SETNLS NLS$CURRENCY, 'Eur'

 

The above statement sets the currency prefix as "Eur"

 

 

SETNLS NLS$DECIMAL, ','

SETNLS NLS$THOUSANDS, '.'

DISPLAY 123.45

DISPLAY "123.45" + 0

DISPLAY "123,45" + 0

All three of the DISPLAY statements in the above program fragment will display

123,45

 

 
See also:

NLS