Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/string/byte"

From cppreference.com
< cpp‎ | string
(expanded description)
(+strtoimax/umax +headers)
Line 12: Line 12:
  
 
{{dcl list h2 | Character manipulation}}
 
{{dcl list h2 | Character manipulation}}
 +
{{dcl list header | cctype}}
 
{{dcl list template | cpp/string/narrow/dcl list isalnum}}
 
{{dcl list template | cpp/string/narrow/dcl list isalnum}}
 
{{dcl list template | cpp/string/narrow/dcl list isalpha}}
 
{{dcl list template | cpp/string/narrow/dcl list isalpha}}
Line 31: Line 32:
  
 
{{dcl list h2 | Conversions to numeric formats}}
 
{{dcl list h2 | Conversions to numeric formats}}
 +
{{dcl list header | cstdlib}}
 
{{dcl list template | cpp/string/narrow/dcl list atof}}
 
{{dcl list template | cpp/string/narrow/dcl list atof}}
 
{{dcl list template | cpp/string/narrow/dcl list atoi}}
 
{{dcl list template | cpp/string/narrow/dcl list atoi}}
Line 36: Line 38:
 
{{dcl list template | cpp/string/narrow/dcl list strtoul}}
 
{{dcl list template | cpp/string/narrow/dcl list strtoul}}
 
{{dcl list template | cpp/string/narrow/dcl list strtof}}
 
{{dcl list template | cpp/string/narrow/dcl list strtof}}
 +
{{dcl list header  | cinttypes}}
 +
{{dcl list template | cpp/string/narrow/dcl list strtoimax}}
  
 
{{dcl list h2 | String manipulation}}
 
{{dcl list h2 | String manipulation}}
 +
{{dcl list header | cstring}}
 
{{dcl list template | cpp/string/narrow/dcl list strcpy}}
 
{{dcl list template | cpp/string/narrow/dcl list strcpy}}
 
{{dcl list template | cpp/string/narrow/dcl list strncpy}}
 
{{dcl list template | cpp/string/narrow/dcl list strncpy}}
Line 45: Line 50:
  
 
{{dcl list h2 | String examination}}
 
{{dcl list h2 | String examination}}
 +
{{dcl list header | cstring}}
 
{{dcl list template | cpp/string/narrow/dcl list strlen}}
 
{{dcl list template | cpp/string/narrow/dcl list strlen}}
 
{{dcl list template | cpp/string/narrow/dcl list strcmp}}
 
{{dcl list template | cpp/string/narrow/dcl list strcmp}}
Line 58: Line 64:
  
 
{{dcl list h2 | Memory manipulation}}
 
{{dcl list h2 | Memory manipulation}}
 +
{{dcl list header | cstring}}
 
{{dcl list template | cpp/string/narrow/dcl list memchr}}
 
{{dcl list template | cpp/string/narrow/dcl list memchr}}
 
{{dcl list template | cpp/string/narrow/dcl list memcmp}}
 
{{dcl list template | cpp/string/narrow/dcl list memcmp}}
Line 65: Line 72:
  
 
{{dcl list h2 | Miscellaneous}}
 
{{dcl list h2 | Miscellaneous}}
 +
{{dcl list header | cstring}}
 
{{dcl list template | cpp/string/narrow/dcl list strerror}}
 
{{dcl list template | cpp/string/narrow/dcl list strerror}}
 
{{dcl list end}}
 
{{dcl list end}}

Revision as of 14:00, 10 November 2011

Template:cpp/string/narrow/sidebar

A null-terminated byte string (NTBS) or "narrow string", is a sequence of nonzero bytes followed by a byte with value zero (the terminating null character). Each byte in a narrow string encodes one character of some character set. For example, the character array Template:cpp} is an NTBS holding the string Template:cpp in ASCII encoding.

A null-terminated multibyte string (NTMBS), or "multibyte string", is also a sequence of nonzero bytes followed by a byte with value zero (the terminating null character), but each character stored in the string may occupy more than one byte. For example, the char array Template:cpp} is an NTMBS holding the string Template:cpp in UTF-8 multibyte encoding: the first three bytes encode the character 你, the next three bytes encode the character 好.

An NTMBS is only valid if it begins and ends in the initial shift state: if the string above began with Template:cpp, a byte that cannot appear in the initial shift state of UTF-8 (that is, it cannot be the first byte of a multibyte character), the sequence would not be an NTMBS. A multibyte character string is layout-compatible with narrow character string, that is, can be stored, copied, and examined using the same facilities, except for the length calculation. Multibyte strings can be converted to and from wide strings using appropriate conversion functions.

Template:cpp/string/narrow/dcl list isalnumTemplate:cpp/string/narrow/dcl list isalphaTemplate:cpp/string/narrow/dcl list islowerTemplate:cpp/string/narrow/dcl list isupperTemplate:cpp/string/narrow/dcl list isdigitTemplate:cpp/string/narrow/dcl list isxdigitTemplate:cpp/string/narrow/dcl list iscntrlTemplate:cpp/string/narrow/dcl list isgraphTemplate:cpp/string/narrow/dcl list isspaceTemplate:cpp/string/narrow/dcl list isblankTemplate:cpp/string/narrow/dcl list isprintTemplate:cpp/string/narrow/dcl list ispunctTemplate:cpp/string/narrow/dcl list tolowerTemplate:cpp/string/narrow/dcl list toupper

Contents

Functions

Character manipulation
Defined in header <cctype>
ASCII values characters

iscntrl
iswcntrl

isprint
iswprint

isspace
iswspace

isblank
iswblank

isgraph
iswgraph

ispunct
iswpunct

isalnum
iswalnum

isalpha
iswalpha

isupper
iswupper

islower
iswlower

isdigit
iswdigit

isxdigit
iswxdigit

decimal hexadecimal octal
0–8 \x0\x8 \0\10 control codes (NUL, etc.) ≠0 0 0 0 0 0 0 0 0 0 0 0
9 \x9 \11 tab (\t) ≠0 0 ≠0 ≠0 0 0 0 0 0 0 0 0
10–13 \xA\xD \12\15 whitespaces (\n, \v, \f, \r) ≠0 0 ≠0 0 0 0 0 0 0 0 0 0
14–31 \xE\x1F \16\37 control codes ≠0 0 0 0 0 0 0 0 0 0 0 0
32 \x20 \40 space 0 ≠0 ≠0 ≠0 0 0 0 0 0 0 0 0
33–47 \x21\x2F \41\57 !"#$%&'()*+,-./ 0 ≠0 0 0 ≠0 ≠0 0 0 0 0 0 0
48–57 \x30\x39 \60\71 0123456789 0 ≠0 0 0 ≠0 0 ≠0 0 0 0 ≠0 ≠0
58–64 \x3A\x40 \72\100 :;<=>?@ 0 ≠0 0 0 ≠0 ≠0 0 0 0 0 0 0
65–70 \x41\x46 \101\106 ABCDEF 0 ≠0 0 0 ≠0 0 ≠0 ≠0 ≠0 0 0 ≠0
71–90 \x47\x5A \107\132 GHIJKLMNOP
QRSTUVWXYZ
0 ≠0 0 0 ≠0 0 ≠0 ≠0 ≠0 0 0 0
91–96 \x5B\x60 \133\140 [\]^_` 0 ≠0 0 0 ≠0 ≠0 0 0 0 0 0 0
97–102 \x61\x66 \141\146 abcdef 0 ≠0 0 0 ≠0 0 ≠0 ≠0 0 ≠0 0 ≠0
103–122 \x67\x7A \147\172 ghijklmnop
qrstuvwxyz
0 ≠0 0 0 ≠0 0 ≠0 ≠0 0 ≠0 0 0
123–126 \x7B\x7E \172\176 {|}~ 0 ≠0 0 0 ≠0 ≠0 0 0 0 0 0 0
127 \x7F \177 backspace character (DEL) ≠0 0 0 0 0 0 0 0 0 0 0 0
Template:cpp/string/narrow/dcl list atofTemplate:cpp/string/narrow/dcl list atoiTemplate:cpp/string/narrow/dcl list strtolTemplate:cpp/string/narrow/dcl list strtoulTemplate:cpp/string/narrow/dcl list strtofTemplate:cpp/string/narrow/dcl list strtoimaxTemplate:cpp/string/narrow/dcl list strcpyTemplate:cpp/string/narrow/dcl list strncpyTemplate:cpp/string/narrow/dcl list strcatTemplate:cpp/string/narrow/dcl list strncatTemplate:cpp/string/narrow/dcl list strxfrmTemplate:cpp/string/narrow/dcl list strlenTemplate:cpp/string/narrow/dcl list strcmpTemplate:cpp/string/narrow/dcl list strncmpTemplate:cpp/string/narrow/dcl list strcollTemplate:cpp/string/narrow/dcl list strchrTemplate:cpp/string/narrow/dcl list strrchrTemplate:cpp/string/narrow/dcl list strspnTemplate:cpp/string/narrow/dcl list strcspnTemplate:cpp/string/narrow/dcl list strpbrkTemplate:cpp/string/narrow/dcl list strstrTemplate:cpp/string/narrow/dcl list strtokTemplate:cpp/string/narrow/dcl list memchrTemplate:cpp/string/narrow/dcl list memcmpTemplate:cpp/string/narrow/dcl list memsetTemplate:cpp/string/narrow/dcl list memcpyTemplate:cpp/string/narrow/dcl list memmoveTemplate:cpp/string/narrow/dcl list strerror
Conversions to numeric formats
Defined in header <cstdlib>
Defined in header <cinttypes>
String manipulation
Defined in header <cstring>
String examination
Defined in header <cstring>
Memory manipulation
Defined in header <cstring>
Miscellaneous
Defined in header <cstring>