Definition and Usage
定义和用法
The nl_langinfo() function returns specific local information.
nl_langinfo()函数的作用是:获取语言及本地信息。
This function returns the specific information on success, or FALSE on failure.
如果函数执行成功,将获取指定的本地信息;如果执行失败将返回False。
Syntax
语法
Parameter参数 | Description描述 |
element | Required. Specifies which element to return. Must be one of the following elements: 必要参数。指定返回的元素对象。必须是下面的元素之一: Time and Calendar: 时间和日期: - ABDAY_(1-7) - Abbreviated name of the numbered day of the week
ABDAY_(1-7) – 数字1-7代表一星期的每一天 - DAY_(1-7) - Name of the numbered day of the week (DAY_1 = Sunday)
DAY_(1-7) –代表一星期每一天的数字名称(DAY_1 = Sunday) - ABMON_(1-12) - Abbreviated name of the numbered month of the year
ABMON_(1-12) -数字1-12代表一年中的每一个月 - MON_(1-12) - Name of the numbered month of the year
代表一年中每个月的数字名称 - 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 – 用来表示时间和日期的格式字符串 - D_FMT - String that can be used as the format string for strftime() to represent date
D_FMT -用来表示日期的格式字符串 - T_FMT - String that can be used as the format string for strftime() to represent time
T_FMT -用来表示时间的格式字符串 - 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格式来表示的时间(12小时显示格式) - ERA - Alternate era
ERA –世纪转换 - ERA_YEAR - Year in alternate era format
ERA_YEAR – 以年份表示的世纪格式 - ERA_D_T_FMT - Date and time in alternate era format (string can be used in strftime())
ERA_D_T_FMT -以日期和时间来表示世纪格式(可通过strftime()函数声明字符串) - ERA_D_FMT - Date in alternate era format (string can be used in strftime())
ERA_D_FMT -以日期来表示世纪格式(可通过strftime()函数声明字符串) - ERA_T_FMT - Time in alternate era format (string can be used in strftime())
ERA_T_FMT - 以时间来表示世纪格式(可通过strftime()函数声明字符串) Monetary Category: 货币符号目录: - INT_CURR_SYMBOL - Currency symbol (example: USD)
INT_CURR_SYMBOL – 货币符号(如:USD) - CURRENCY_SYMBOL - Currency symbol (example: $)
CURRENCY_SYMBOL – 货币符号(如:$) - CRNCYSTR - Same as CURRENCY_SYMBOL
CRNCYSTR - 与CURRENCY_SYMBOL相类似 - MON_DECIMAL_POINT - Monetary decimal point character
MON_DECIMAL_POINT – 货币小数点字符 - MON_THOUSANDS_SEP - Monetary thousands separator
MON_THOUSANDS_SEP – 货币千位分隔符 - POSITIVE_SIGN - Positive value character
POSITIVE_SIGN – 正值字符 - NEGATIVE_SIGN -Negative value character
NEGATIVE_SIGN – 负值字符 - MON_GROUPING - Array displaying how monetary numbers are grouped (example: 1 000 000)
MON_GROUPING – 货币数字的组合形式(如:1 000 000) - INT_FRAC_DIGITS - International fractional digits
INT_FRAC_DIGITS – 国际通用小数位 - FRAC_DIGITS - Local fractional digits
FRAC_DIGITS – 本地通用小数位 - 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 – 如果货币符号在一个正数值之前显示,则为True(1);如果在正数值之后显示,则为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 -如果在货币符号和正数值之间包含空格,则为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 -如果货币符号在一个负数值之前显示,则为True(1);如果在负数值之后显示,则为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 -如果在货币符号和负数值之间包含空格,则为True(1);如果不包含空格,则为False(0) - P_SIGN_POSN - Formatting setting. Possible return values:
P_SIGN_POSN –格式设置,可选值如下: - 0 - Parentheses surround the quantity and currency symbol
0 – 将数量和货币符号写在圆括号内 - 1 - The sign string is placed in front of the quantity and currency symbol
1 – 在数量和货币符号之前加上符号 - 2 - The sign string is placed after the quantity and currency symbol
2 – 在数量和货币符号之后加上符号 - 3 - The sign string is placed immediately in front of the currency symbol
3 – 直接在货币符号之前加上符号 - 4 - The sign string is placed immediately after the currency symbol
4 – 直接在货币符号之后加上符号 - N_SIGN_POSN - Formatting setting. Possible return values:
N_SIGN_POSN –格式设置,可选值如下: - 0 - Parentheses surround the quantity and currency symbol
0 – 将数量和货币符号写在圆括号内 - 1 - The sign string is placed in front of the quantity and currency symbol
1 – 在数量和货币符号之前加上符号 - 2 - The sign string is placed after the quantity and currency symbol
2 – 在数量和货币符号之后加上符号 - 3 - The sign string is placed immediately in front of the currency symbol
3 – 直接在货币符号之前加上符号 - 4 - The sign string is placed immediately after the currency symbol
4 – 直接在货币符号之后加上符号 Numeric Category: 数值型目录: - DECIMAL_POINT - Decimal point character
• DECIMAL_POINT – 小数字符 - 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 -货币数字的组合形式(如:1 000 000) Messaging Category: 信息目录: - YESEXPR - Regex string for matching 'yes' input
• YESEXPR - 与“yes” 输入相匹配的Regex字符串 - NOEXPR - Regex string for matching 'no' input
• NOEXPR -与“no” 输入相匹配的Regex字符串 - YESSTR - Output string for 'yes'
• YESSTR – “Yes”的输出结果字符串 - NOSTR - Output string for 'no'
• NOSTR - “No”的输出结果字符串 Code set Category: 代码属性目录: - CODESET Return a string with the name of the character encoding.
• CODESET 返回一个带有字符编码的字符串 |
Tips and Notes
提示和注意点
Note: This function does not work on Windows platforms.
注意:Windows操作平台不支持money_format()函数。
Tip: Unlike the localeconv() function, which returns all local formatting information, the nl_langinfo() function returns specific information.
提示:nl_langinfo()函数与localeconv()函数的不同点在于:localeconv()函数返回的是所有的本地信息,而nl_langinfo()函数返回的是用户指定的信息。