Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (s) strxfrm(3)
NAME
strxfrm - Transforms string for collation in current locale
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <string.h>
size_t strxfrm(
char *s1,
const char *s2,
size_t n);
PARAMETERS
s1 Specifies the destination string.
s2 Specifies the string to be transformed.
n Specifies the maximum number of bytes to store in the transformed string.
DESCRIPTION
The strxfrm( ) function transforms the string pointed to by the s2 parameter into an internal form
suitable for collation and places the result in the address specified is transformation is performed
as appropriate to the LC_COLLATE category of the current locale. When the strcmp() func-
tion is applied to two transformed strings, a value greater than, equal to, or less than 0 (zero) is
returned. The returned value corresponds to the same value that is returned when the strcoll( )
function is applied to the same two original transformed strings. The transformed string can be
longer than the original string. No more than n characters are placed in the location pointed to by
the s1 parameter, including the terminating null character. When n is 0 (zero), the s1 parameter
can be a null pointer. When operating on overlapping strings, the behavior of this function is
unreliable.
NOTES
If you are doing multiple comparisons using the same set of text strings, the strxfrm( ) transfor-
mation function in conjunction with the strcmp( ) function may be more efficient than using the
strcoll( ) collation function because the string is transformed based on the locale tables only
once. However, the transformation function must convert all characters in the string for each
level of a multi-level collation. In comparison, the collation function stops comparing characters
at the first inequality. These efficiency tradeoffs make the most efficient method for a specific
application dependent on both the number of repeated comparisons for each string and the con-
tents of each string.
RETURN VALUES
Upon successful completion, the strxfrm( ) function returns the number of bytes required to
store the fully transformed string. If this is greater than or equal to the value of the n parameter,
which specifies the maximum number of bytes that can be stored in s1, the contents of s1 are
indeterminate.
527187-017 Hewlett-Packard Company 6197