Next: swab, Previous: strupr, Up: Strings

### 5.40 `strxfrm`—transform string

Synopsis

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

Description
This function transforms the string pointed to by s2 and places the resulting string into the array pointed to by s1. The transformation is such that if the `strcmp` function is applied to the two transformed strings, it returns a value greater than, equal to, or less than zero, correspoinding to the result of a `strcoll` function applied to the same two original strings.

No more than n characters are placed into the resulting array pointed to by s1, including the terminating null character. If n is zero, s1 may be a null pointer. If copying takes place between objects that overlap, the behavior is undefined.

With a C locale, this function just copies.

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

Portability
`strxfrm` is ANSI C.

`strxfrm` requires no supporting OS subroutines.