strxfrm()

transform string 

Function


SYNOPSIS

#include <string.h>

size_t strxfrm(char *s1, const char *s2, size_t n);


DESCRIPTION

The strxfrm() function transforms the string pointed to by s2 so that strcmp() can be used for lexical comparisons, taking into consideration the value of LC_COLLATE. The transformations performed by strxfrm() are such that, if two strings are transformed, the lexical relationship of the transformed strings as determined by strcmp() is the same as the lexical relationship of the original strings as determined by strcoll(). The transformed string is placed into the buffer pointed to by s1.

If n is zero, then s1 may be null. In this case, strxfrm() returns the number of characters in s2 it would transform. The terminating null-character is not included.

For the C locale, strxfrm() is equivalent to:

strncpy(s1, s2, n);
return strlen(s1);

PARAMETERS

s1 

Either NULL, or a pointer to a buffer to receive the transformed string.

s2 

Points to a null-terminated string to be transformed for collating.

n 

Is the maximum number of characters to transform.


RETURN VALUES

The strxfrm() function returns the length of the transformed string, excluding the terminating null character. If the value returned is n or more, the contents of the array pointed to by s1 are undetermined.

If strxfrm() encounters a character outside of the collating sequence defined for the current locale, it sets errno to EINVAL.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

This function is MT-Safe as long as no thread calls setlocale() while this function is executing.


PORTING ISSUES

None.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
localeconv(), setlocale(), strcmp(), strcoll()


MKS Toolkit 9.2 Documentation Build 16.