Name

strxfrm - string transformation

Library

libc.lib

Synopsis

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

Return values

Upon successful completion, strxfrm returns the length of the transformed string not including the terminating null character. If this value is n or more, the contents of dst are indeterminate.

Detailed description

The strxfrm function transforms a null-terminated string pointed to by src according to the current locale collation if any, then copies the transformed string into dst. Not more than n characters are copied into dst, including the terminating null character added. If n is set to 0 (it helps to determine an actual size needed for transformation), dst is permitted to be a NULL pointer.

Comparing two strings using strcmp after strxfrm is equal to comparing two original strings with strcoll.


Examples

#include <string.h>
#include <stdio.h>
int main()
{
    char src2[20] = "abc";
    char dst1[20] = {’\0’};
    char src1[20] = "abc";
    char dst2[20] = {’\0’};
    int retx1;
    int retx2;
    int retc;
    retx1 = strxfrm(dst1,src1,strlen(src1));
    retx2 = strxfrm(dst2,src2,strlen(src2));
    if((retc = strcmp(dst1,dst2))== 0)
        printf("Strings are same\n");
}

         

Output

Strings are same

         

See also

setlocale, strcmp, strcoll, wcsxfrm
The strxfrm function conforms to -isoC.

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top