Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > L

localeconv(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

localeconv() — query the numeric formatting conventions of the current locale

SYNOPSIS

#include <locale.h>

struct lconv *localeconv(void);

DESCRIPTION

The localeconv() function sets the components of an object of type struct lconv (defined in <locale.h>) with values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the program's current locale (see setlocale(3C)).

The members of the structure with type char * are strings, any of which (except decimal_point) can point to "" (the empty string) to indicate that the value is not available in the current locale or is of zero length. The members with type char are non-negative numbers, any of which can be CHAR_MAX (defined in <limits.h>) to indicate that the value is not available in the current locale. The members include the following:

char *decimal_point

The decimal point character used to format nonmonetary quantities. This is the same value as that returned by a call to nl_langinfo() with RADIXCHAR as its argument (see nl_langinfo(3C)).

char *thousands_sep

The character used to separate groups of digits to the left of the decimal point character in formatted nonmonetary quantities. This is the same value as that returned by a call to nl_langinfo() with THOUSEP as its argument (see nl_langinfo(3C)).

char *grouping

A string where the numeric value of each byte indicates the size of each group of digits in formatted nonmonetary quantities.

char *int_curr_symbol

The international currency symbol applicable to the current locale. The first three characters contain the alphabetic international currency symbol in accordance with those specified in ISO 4217 Codes for the Representation of Currency and Funds. The fourth character (immediately preceding the null character) is the character used to separate the international currency symbol from the monetary quantity.

char *currency_symbol

The local currency symbol applicable to the current locale. This value along with positioning information is returned by a call to nl_langinfo() with CRNCYSTR as its argument (see nl_langinfo(3C)).

char *mon_decimal_point

The decimal point used to format monetary quantities.

char *mon_thousands_sep

The separator for groups of digits to the left of the decimal point in formatted monetary quantities.

char *mon_grouping

A string where the numeric value of each byte indicates the size of each group of digits in formatted monetary quantities.

char *positive_sign

The string used to indicate a positive valued formatted monetary quantity.

char *negative_sign

The string used to indicate a negative valued formatted monetary quantity.

char int_frac_digits

The number of fractional digits (those to the right of the decimal point) to be displayed in an internationally formatted monetary quantity.

char frac_digits

The number of fractional digits (those to the right of the decimal point) to be displayed in a locally formatted monetary quantity.

char p_cs_precedes

Set to 1 or 0 if the currency_symbol precedes or succeeds the value for a non-negative formatted monetary quantity.

char p_sep_by_space

Set to a value indicating the separation of the currency_symbol, the sign string, and the value of a non-negative formatted monetary quantity.

char n_cs_precedes

Set to 1 or 0 if the currency_symbol precedes or succeeds the value for a negative formatted monetary quantity.

char n_sep_by_space

Set to a value indicating the separation of the currency_symbol, the sign string, and the value of a negative formatted monetary quantity.

char p_sign_posn

Set to a value indicating the positioning of the positive_sign for a non-negative formatted monetary quantity.

char n_sign_posn

Set to a value indicating the positioning of the negative_sign for a negative formatted monetary quantity.

The following members are also available to UNIX 2003 conforming applications:

char int_p_cs_precedes

Set to 1 or 0 if the int_currency_symbol precedes or succeeds the value for a non-negative internationally formatted monetary quantity.

char int_p_sep_by_space

Set to a value indicating the separation of the int_currency_symbol, the sign string, and the value of a non-negative internationally formatted monetary quantity.

char int_n_cs_precedes

Set to 1 or 0 if the int_currency_symbol precedes or succeeds the value for a negative internationally formatted monetary quantity.

char int_n_sep_by_space

Set to a value indicating the separation of the int_currency_symbol, the sign string, and the value of a negative internationally formatted monetary quantity.

char int_p_sign_posn

Set to a value indicating the positioning of the positive_sign for a non-negative internationally formatted monetary quantity.

char int_n_sign_posn

Set to a value indicating the positioning of the negative_sign for a negative internationally formatted monetary quantity.

The numeric value of each byte of grouping and mon_grouping is interpreted according to the following:

CHAR_MAX

No further grouping is to be performed.

0

The previous byte is to be repeatedly used for the remainder of the digits.

other

The value is the number of digits that comprise the current group. The next byte is examined to determine the size of the next group of digits to the left of the current group.

The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space, and int_n_sep_by_space are interpreted according to the following:

0

No space separates the currency symbol and value.

1

If the currency symbol and sign string are adjacent, a space separates them from the value; otherwise, a space separates the currency symbol from the value.

2

If the currency symbol and sign string are adjacent, a space separates them; otherwise, a space separates the sign string from the value.

For int_p_sep_by_space and int_n_sep_by_space, the fourth character of int_curr_symbol is used instead of a space for UNIX 2003 conforming applications.

The values of p_sign_posn and n_sign_posn are interpreted according to the following:

0

Parentheses surround the quantity and currency_symbol or int_curr_symbol.

1

The sign string precedes the quantity and currency_symbol or int_curr_symbol.

2

The sign string succeeds the quantity and currency_symbol or int_curr_symbol.

3

The sign string immediately precedes the currency_symbol or int_curr_symbol.

4

The sign string immediately succeeds the currency_symbol or int_curr_symbol.

localeconv() behaves as if no library function calls localeconv().

EXTERNAL INFLUENCES

Locale

The LC_NUMERIC category influences the decimal_point, thousands_sep, and grouping members of the structure referenced by the pointer returned from a call to localeconv().

The LC_MONETARY category influences all of the other members of this structure.

International Code Set Support

Single and multibyte character codesets are supported.

RETURN VALUE

localeconv() returns a pointer to the filled-in struct lconv.

EXAMPLES

The following table illustrates the formatting used in five languages for monetary quantities.

CountryPositive formatNegative formatInternational format
en_US.iso88591$1,234.56-$1,234.56USD 1,234.56
it_IT.iso88591L.1.234-L.1.234ITL.1.234
nl_NL.iso88591F 1.234,56F -1.234,56NLG 1.234,56
no_NO.iso88591kr1.234,56kr1.234,56-NOK 1.234,56
pt_PT.iso885911,234$56-1,234$56PTE 1,234$56

For these five languages, the respective values for the monetary members of the structure returned by localeconv() are:

 en_US.it_IT.nl_NL.no_NO.pt_PT.
iso88591iso88591.iso88591iso88591iso88591 
int_curr_symbolUSDITL.NLGNOKPTE
currency_symbol$L.Fkr$
mon_decimal_point."",,$
mon_thousands_sep,...,
mon_grouping\3\3\3\3\3
positive_sign""""""""""
negative_sign-----
int_frac_digits20222
frac_digits20222
p_cs_precedes11110
p_sep_by_space00100
n_cs_precedes11110
n_sep_by_space00100
p_sign_posn11111
n_sign_posn41421

WARNINGS

The structure returned by localeconv() should not be modified by the calling program. Calls to setlocale() with categories LC_ALL, LC_MONETARY, or LC_NUMERIC can overwrite the contents of the structure that localeconv() points to when it returns (see setlocale(3C)).

AUTHOR

localeconv() was developed by OSF and HP.

STANDARDS CONFORMANCE

localeconv(): AES, SVID3, XPG4, ANSI C

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.