Cpp Standard Library 简明教程

C++ Library - <locale>

Introduction

它是一个本地化库,并且是一组与文化相关的特性,程序可以使用它在国际上具有更好的可移植性。

It is a localization library and a set of features that are culture-specific, which can be used by programs to be more portable internationally.

Declaration

以下是 std::locale 的声明。

Following is the declaration for std::locale.

class locale;

C++11

class locale;

Functions

Sr.No.

Function & description

1

use_facetIt is used to access facet of locale.

2

has_facetIt is used to check if locale has facet.

Convenience interfaces

Sr.No.

Interface & description

1

isspaceIt checks if character is a white-space.

2

isprintIt checks if character is printable.

3

iscntrlIt checks if character is a control character.

4

isupperIt checks if character is uppercase letter.

5

islowerIt checks if character is lowercase letter.

6

isalphaIt checks if character is alphabetic.

7

isdigitIt checks if character is decimal digit.

8

ispunctIt checks if character is a punctuation character.

9

isxdigitIt checks if character is hexadecimal digit.

10

isalnumIt checks if character is alphanumeric.

11

isgraphIt checks if character has graphical representation.

12

isblank It checks if character is blank.

Standard facets

Sr.No.

Standard facet & description

1

ctypeIt is a character type facet.

2

ctype_bynameIt is a character type facet.

3

codecvtIt is used to convert codeset facet.

4

codecvt_bynameIt is used to convert codeset facet.

5

num_getIt is a facet to parse numeric values.

6

num_putIt is a facet to format numeric values.

7

numpunctIt is a numeric punctuation facet.

8

numpunct_bynameIt is a numeric punctuation facet.

9

collateIt is a facet to compare and hash strings.

10

collate_bynameIt is a facet to compare and hash strings.

11

time_getIt is a facet to parse dates and times.

12

time_get_bynameIt is a facet to parse dates and times.

13

time_putIt is a facet to format dates and times.

14

time_put_bynameIt is a facet to format dates and times.

15

money_getIt is a facet to parse monetary expressions.

16

money_putIt is a facet to format monetary expressions.

17

moneypunctIt is a monetary punctuation facet.

18

moneypunct_bynameIt is a monetary punctuation facet.

19

messagesIt is a facet to access message catalogs.

20

messages_bynameIt is a facet to access message catalogs.

Class

Sr.No.

Class & description

1

localeIt is a locale class.