Wide String Handling

┌──────────────────────────────────────────────────────────────────────┐
│XPG4 provides wide-string handling functions equivalent to those for  │
│the multibyte string. The behavior of these functions are affected by │
│the LC_CTYPE category of the current locale.                          │
└──────────────────────────────────────────────────────────────────────┘

The following table shows the wide string functions.

┌────────────────────┬────────────────────┬─────────────────────────┐
│byte-based          │wide-based          │Descriptions             │
├────────────────────┼────────────────────┼─────────────────────────┤
│strcat              │wcscat              │Concatenates two (wide)  │
│                    │                    │strings.                 │
├────────────────────┼────────────────────┼─────────────────────────┤
│strchr              │wcschr              │Locates the first        │
│                    │                    │occurrence of a specified│
│                    │                    │(wide) character in a    │
│                    │                    │(wide) string.           │
├────────────────────┼────────────────────┼─────────────────────────┤
│strcmp              │wcscmp              │Compares the value of two│
│                    │                    │(wide) strings.          │
├────────────────────┼────────────────────┼─────────────────────────┤
│strcoll             │wcscoll (**)        │Compares two (wide)      │
│                    │                    │strings based on the     │
│                    │                    │collating elements for   │
│                    │                    │the current locale.      │
├────────────────────┼────────────────────┼─────────────────────────┤
│strcpy              │wcscpy              │Copies one (wide) string │
│                    │                    │to another.              │
├────────────────────┼────────────────────┼─────────────────────────┤
│strcspn             │wcscspn             │Finds the first          │
│                    │                    │occurrence of a (wide)   │
│                    │                    │character in a (wide)    │
│                    │                    │string.                  │
├────────────────────┼────────────────────┼─────────────────────────┤
│strlen              │wcslen              │Calculates the length in │
│                    │                    │byte (wide characters) in│
│                    │                    │a (wide) string.         │
├────────────────────┼────────────────────┼─────────────────────────┤
│strncat             │wcsncat             │Adds a specified length  │
│                    │                    │in bytes (wide           │
│                    │                    │characters) of one (wide)│
│                    │                    │string to another.       │
├────────────────────┼────────────────────┼─────────────────────────┤
│strncmp             │wcsncmp             │Compares two (wide)      │
│                    │                    │strings up to a specified│
│                    │                    │length in bytes (wide    │
│                    │                    │characters).             │
├────────────────────┼────────────────────┼─────────────────────────┤
│strncpy             │wcsncpy             │Copies a specified length│
│                    │                    │in bytes (wide           │
│                    │                    │characters) of one (wide)│
│                    │                    │string to another.       │
├────────────────────┼────────────────────┼─────────────────────────┤
│strpbrk             │wcspbrk             │Locates specified (wide) │
│                    │                    │characters in a (wide)   │
│                    │                    │string.                  │
├────────────────────┼────────────────────┼─────────────────────────┤
│strrchr             │wcsrchr             │Locates the last         │
│                    │                    │occurrence of a (wide)   │
│                    │                    │character in a (wide)    │
│                    │                    │string.                  │
├────────────────────┼────────────────────┼─────────────────────────┤
│strstr              │wcswcs              │Locates the first        │
│                    │                    │occurrence of a (wide)   │
│                    │                    │string in another.       │
├────────────────────┼────────────────────┼─────────────────────────┤
│strtok              │wcstok (**)         │Locates a specified token│
│                    │                    │in a (wide) string.      │
├────────────────────┼────────────────────┼─────────────────────────┤
│strxfrm             │wcsxfrm (**)        │Transforms (wide) strings│
│                    │                    │according to the current │
│                    │                    │locale.                  │
└────────────────────┴────────────────────┴─────────────────────────┘

The corresponding functions work similar except that:

In addition, the following two functions are provided:

┌───────────────┬─────────────────────────────────────────────┐│Function name  │Descriptions                                 │
├───────────────┼─────────────────────────────────────────────┤
│mblen          │Determines the length of a multibyte         │
│               │character.                                   │
├───────────────┼─────────────────────────────────────────────┤
│wcswidth       │Determin the number of columns in a wide     │
│               │string.                                      │
└───────────────┴─────────────────────────────────────────────┘


[Back: Processing Strings]
[Next: Wide Character Testing and Conversion Functions]