Easy Tutorial
❮ C Function Labs C Function Iscntrl ❯

C Library Function - strxfrm()

C Standard Library - <string.h>

Description

The C library function sizet strxfrm(char *dest, const char *src, sizet n) transforms the first n characters of the string src according to the LC_COLLATE category of the current locale and places them in the string dest.

Declaration

Here is the declaration for the strxfrm() function.

size_t strxfrm(char *dest, const char *src, size_t n)

Parameters

Return Value

The function returns the length of the transformed string, not including the null-terminating character.

Example

The following example demonstrates the use of the strxfrm() function.

#include <stdio.h>
#include <string.h>

int main()
{
   char dest[20];
   char src[20];
   int len;

   strcpy(src, "W3C School");
   len = strxfrm(dest, src, 20);

   printf("The length of string |%s| is: |%d|", dest, len);

   return(0);
}

Let's compile and run the above program, which will produce the following result:

The length of string |W3C School| is: |10|

C Standard Library - <string.h>

❮ C Function Labs C Function Iscntrl ❯