1strxfrm(3C)              Standard C Library Functions              strxfrm(3C)
2
3
4

NAME

6       strxfrm - string transformation
7

SYNOPSIS

9       #include <string.h>
10
11       size_t strxfrm(char *restrict s1, const char *restrict s2, size_t n);
12
13

DESCRIPTION

15       The  strxfrm()  function  transforms  the  string  pointed to by s2 and
16       places the resulting string into the array pointed to by s1. The trans‐
17       formation  is  such  that  if  strcmp(3C) is applied to two transformed
18       strings, it returns a value greater than, equal to or less than 0, cor‐
19       responding  to the result of strcoll(3C) applied to the same two origi‐
20       nal strings. No more than n bytes are placed into the  resulting  array
21       pointed  to  by s1, including the terminating null byte.  If n is 0, s1
22       is permitted to be a null  pointer.  If  copying  takes  place  between
23       objects that overlap, the behavior is undefined.
24
25
26       The strxfrm() function does not change the setting of errno if success‐
27       ful.
28
29
30       Since no return value is reserved to indicate an error, an  application
31       wishing  to check for error situations should set errno to 0, then call
32       strxfrm(), then check errno.
33

RETURN VALUES

35       Upon successful completion, strxfrm() returns the length of the  trans‐
36       formed  string  (not including the terminating null byte). If the value
37       returned is n or more, the contents of the array pointed to by  s1  are
38       indeterminate.
39
40
41       On  error,  strxfrm()  may set errno but no return value is reserved to
42       indicate the error.
43

USAGE

45       The transformation function is such that two transformed strings can be
46       ordered  by strcmp(3C) as appropriate to collating sequence information
47       in the program's locale (category LC_COLLATE).
48
49
50       The fact that when n is 0, s1 is permitted to be  a  null  pointer,  is
51       useful to determine the size of the s1 array prior to making the trans‐
52       formation.
53

EXAMPLES

55       Example 1 A sample of using the strxfm() function.
56
57
58       The value of the following expression is the size of the  array  needed
59       to hold the transformation of the string pointed to by s.
60
61
62         1 + strxfrm(NULL, s, 0);
63
64

FILES

66       /usr/lib/locale/locale/locale.so.*
67
68           LC_COLLATE database for locale
69
70

ATTRIBUTES

72       See attributes(5) for descriptions of the following attributes:
73
74
75
76
77       ┌─────────────────────────────┬─────────────────────────────┐
78       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
79       ├─────────────────────────────┼─────────────────────────────┤
80       │CSI                          │Enabled                      │
81       ├─────────────────────────────┼─────────────────────────────┤
82       │Interface Stability          │Standard                     │
83       ├─────────────────────────────┼─────────────────────────────┤
84       │MT-Level                     │MT-Safe with exceptions      │
85       └─────────────────────────────┴─────────────────────────────┘
86
87
88       The  strxfrm()  function can be used safely in a multithreaded applica‐
89       tion, as long as setlocale(3C)  is  not  being  called  to  change  the
90       locale.
91

SEE ALSO

93       localedef(1),   setlocale(3C),   strcmp(3C),  strcoll(3C),  wscoll(3C),
94       attributes(5), environ(5), standards(5)
95
96
97
98SunOS 5.11                        10 Dec 2003                      strxfrm(3C)
Impressum