Definition and Usage
定義和用法
The nl_langinfo() function returns specific local information.
nl_langinfo()函數(shù)的作用是:獲取語(yǔ)言及本地信息。
This function returns the specific information on success, or FALSE on failure.
如果函數(shù)執(zhí)行成功,將獲取指定的本地信息;如果執(zhí)行失敗將返回False。
Syntax
語(yǔ)法
nl_langinfo(element)
Parameter參數(shù)
Description描述
element
Required. Specifies which element to return. Must be one of the following elements:
必要參數(shù)。指定返回的元素對(duì)象。必須是下面的元素之一:
Time and Calendar:
時(shí)間和日期:
ABDAY_(1-7) - Abbreviated name of the numbered day of the week
ABDAY_(1-7) – 數(shù)字1-7代表一星期的每一天
DAY_(1-7) - Name of the numbered day of the week (DAY_1 = Sunday)
DAY_(1-7) –代表一星期每一天的數(shù)字名稱(DAY_1 = Sunday)
ABMON_(1-12) - Abbreviated name of the numbered month of the year
ABMON_(1-12) -數(shù)字1-12代表一年中的每一個(gè)月
MON_(1-12) - Name of the numbered month of the year
代表一年中每個(gè)月的數(shù)字名稱
AM_STR - String for Ante meridian
AM_STR – 代表上午的字符串
PM_STR - String for Post meridian
PM_STR – 代表下午的字符串
D_T_FMT - String that can be used as the format string for strftime() to represent time and date
D_T_FMT – 用來(lái)表示時(shí)間和日期的格式字符串
D_FMT - String that can be used as the format string for strftime() to represent date
D_FMT -用來(lái)表示日期的格式字符串
T_FMT - String that can be used as the format string for strftime() to represent time
T_FMT -用來(lái)表示時(shí)間的格式字符串
T_FMT_AMPM - String that can be used as the format string for strftime() to represent time in 12-hour format with ante/post meridian
T_FMT_AMPM -用am和pm格式來(lái)表示的時(shí)間(12小時(shí)顯示格式)
ERA - Alternate era
ERA –世紀(jì)轉(zhuǎn)換
ERA_YEAR - Year in alternate era format
ERA_YEAR – 以年份表示的世紀(jì)格式
ERA_D_T_FMT - Date and time in alternate era format (string can be used in strftime())
ERA_D_T_FMT -以日期和時(shí)間來(lái)表示世紀(jì)格式(可通過(guò)strftime()函數(shù)聲明字符串)
ERA_D_FMT - Date in alternate era format (string can be used in strftime())
ERA_D_FMT -以日期來(lái)表示世紀(jì)格式(可通過(guò)strftime()函數(shù)聲明字符串)
ERA_T_FMT - Time in alternate era format (string can be used in strftime())
ERA_T_FMT - 以時(shí)間來(lái)表示世紀(jì)格式(可通過(guò)strftime()函數(shù)聲明字符串)
Monetary Category:
貨幣符號(hào)目錄:
INT_CURR_SYMBOL - Currency symbol (example: USD)
INT_CURR_SYMBOL – 貨幣符號(hào)(如:USD)
CURRENCY_SYMBOL - Currency symbol (example: $)
CURRENCY_SYMBOL – 貨幣符號(hào)(如:$)
CRNCYSTR - Same as CURRENCY_SYMBOL
CRNCYSTR - 與CURRENCY_SYMBOL相類似
MON_DECIMAL_POINT - Monetary decimal point character
MON_DECIMAL_POINT – 貨幣小數(shù)點(diǎn)字符
POSITIVE_SIGN - Positive value character
POSITIVE_SIGN – 正值字符
NEGATIVE_SIGN -Negative value character
NEGATIVE_SIGN – 負(fù)值字符
MON_GROUPING - Array displaying how monetary numbers are grouped (example: 1 000 000)
MON_GROUPING – 貨幣數(shù)字的組合形式(如:1 000 000)
INT_FRAC_DIGITS - International fractional digits
INT_FRAC_DIGITS – 國(guó)際通用小數(shù)位
FRAC_DIGITS - Local fractional digits
FRAC_DIGITS – 本地通用小數(shù)位
P_CS_PRECEDES - True (1) if currency symbol is placed in front of a positive value, False (0) if it is placed behind
P_CS_PRECEDES – 如果貨幣符號(hào)在一個(gè)正數(shù)值之前顯示,則為True(1);如果在正數(shù)值之后顯示,則為False(0)
P_SEP_BY_SPACE - True (1) if there is a spaces between the currency symbol and a positive value, False (0) otherwise
P_SEP_BY_SPACE -如果在貨幣符號(hào)和正數(shù)值之間包含空格,則為True(1);如果不包含空格,則為False(0)
N_CS_PRECEDES - True (1) if currency symbol is placed in front of a negative value, False (0) if it is placed behind
N_CS_PRECEDES -如果貨幣符號(hào)在一個(gè)負(fù)數(shù)值之前顯示,則為True(1);如果在負(fù)數(shù)值之后顯示,則為False(0)
N_SEP_BY_SPACE - True (1) if there is a spaces between the currency symbol and a negative value, False (0) otherwise
N_SEP_BY_SPACE -如果在貨幣符號(hào)和負(fù)數(shù)值之間包含空格,則為True(1);如果不包含空格,則為False(0)
P_SIGN_POSN - Formatting setting. Possible return values:
P_SIGN_POSN –格式設(shè)置,可選值如下:
0 - Parentheses surround the quantity and currency symbol
0 – 將數(shù)量和貨幣符號(hào)寫在圓括號(hào)內(nèi)
1 - The sign string is placed in front of the quantity and currency symbol
1 – 在數(shù)量和貨幣符號(hào)之前加上符號(hào)
2 - The sign string is placed after the quantity and currency symbol
2 – 在數(shù)量和貨幣符號(hào)之后加上符號(hào)
3 - The sign string is placed immediately in front of the currency symbol
3 – 直接在貨幣符號(hào)之前加上符號(hào)
4 - The sign string is placed immediately after the currency symbol
4 – 直接在貨幣符號(hào)之后加上符號(hào)
N_SIGN_POSN - Formatting setting. Possible return values:
N_SIGN_POSN –格式設(shè)置,可選值如下:
0 - Parentheses surround the quantity and currency symbol
0 – 將數(shù)量和貨幣符號(hào)寫在圓括號(hào)內(nèi)
1 - The sign string is placed in front of the quantity and currency symbol
1 – 在數(shù)量和貨幣符號(hào)之前加上符號(hào)
2 - The sign string is placed after the quantity and currency symbol
2 – 在數(shù)量和貨幣符號(hào)之后加上符號(hào)
3 - The sign string is placed immediately in front of the currency symbol
3 – 直接在貨幣符號(hào)之前加上符號(hào)
4 - The sign string is placed immediately after the currency symbol
4 – 直接在貨幣符號(hào)之后加上符號(hào)
Numeric Category:
數(shù)值型目錄:
DECIMAL_POINT - Decimal point character
• DECIMAL_POINT – 小數(shù)字符
RADIXCHAR - Same as DECIMAL_POINT
• RADIXCHAR – 與DECIMAL_POINT相類似
THOUSANDS_SEP - Separator character for thousands
• THOUSANDS_SEP – 千位分隔字符
THOUSEP - Same as THOUSANDS_SEP
• THOUSEP – 與THOUSANDS_SEP相類似
GROUPING - Array displaying how numbers are grouped (example: 1 000 000)
• GROUPING -貨幣數(shù)字的組合形式(如:1 000 000)
YESSTR - Output string for 'yes'
• YESSTR – “Yes”的輸出結(jié)果字符串
NOSTR - Output string for 'no'
• NOSTR - “No”的輸出結(jié)果字符串
Code set Category:
代碼屬性目錄:
CODESET Return a string with the name of the character encoding.
• CODESET 返回一個(gè)帶有字符編碼的字符串
Tips and Notes
提示和注意點(diǎn) Note: This function does not work on Windows platforms.
注意:Windows操作平臺(tái)不支持money_format()函數(shù)。 Tip: Unlike the localeconv() function, which returns all local formatting information, the nl_langinfo() function returns specific information.
提示:nl_langinfo()函數(shù)與localeconv()函數(shù)的不同點(diǎn)在于:localeconv()函數(shù)返回的是所有的本地信息,而nl_langinfo()函數(shù)返回的是用戶指定的信息。