HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
s
string(3C) string(3C)
strings that determines their relative ordering usually comes among the first few characters.
strxfrm() offers better performance in, for example, a sorting routine where a number of strings are
each transformed just once and the transformed versions are compared against each other many times.
APPLICATION USAGE
The interface strtok() is not thread-safe. All other interfaces documented on this man page are
thread-safe and async-cancel-safe.
EXTERNAL INFLUENCES
Locale
The LC_CTYPE category determines the interpretation of the bytes within the string arguments to the
strcoll() and strxfrm() functions as single and/or multibyte characters. It also determines the
case conversions to be done for the strcasecmp() and strncasecmp() functions.
The LC_COLLATE category determines the collation ordering used by the strcoll() and strxfrm()
functions.
International Code Set Support
Single- and multibyte character code sets are supported for the
strcoll() and strxfrm() functions.
All other functions support only single-byte character code sets.
EXAMPLE
The following sample piece of code finds the tokens, separated by blanks, that are in the string s (assuming
that there are at most
MAXTOK tokens):
int i = 0;
char *s, *last, *tok[MAXTOK];
tok[0] = strtok_r(s, " ", &last);
while (tok[++i] = strtok_r(NULL, " ", &last));
WARNINGS
The functions strcat(), strncat(), strcpy(), strncpy(), strtok(), and strtok_r()
alter the contents of the array to which s1 points. They do not check for overflow of the array.
Null pointers for destination strings cause undefined behavior.
Character movement is performed differently in different implementations, so moves involving overlapping
source and destination strings may yield surprises.
The transformed string produced by strxfrm() for a language using an 8-bit code set is usually at least
twice as large as the original string and may be as much four times as large (ordinary characters occupy
two bytes each in the transformed string, 1-to-2 characters four bytes, 2-to-1 characters two bytes per origi-
nal pair, and don’t-care characters no bytes). Each character of a multibyte code set (Asian languages)
occupies three bytes in the transformed string.
For functions strcoll() and strxfrm() results are undefined if the languages specified by the
LC_COLLATE and LC_CTYPE categories use different code sets.
strtok() is unsafe for multi-thread applications.
strtok_r() is MT-Safe and should be used
instead.
Users of
strtok_r() should also note that the prototype of this function will change in the next release
for conformance with the new POSIX Threads standard.
AUTHOR
string() was developed by the University of California, Berkeley, AT&T, OSF, and HP.
SEE ALSO
conv(3C), malloc(3C), memory(3C), setlocale(3C).
STANDARDS CONFORMANCE
nl_strcmp() : XPG2
nl_strncmp() : XPG2
strcat(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C
Section 3−−888 − 3 − HP-UX Release 11i: December 2000
___
___