C Library Functions -strxfrm()

C Standard Library - <string.h>

Description

C Library Functionssize_t strxfrm(char *dest, const char *src, size_t n)Transform a string according to the LC_COLLATE in the program's current locale setting.srcthe frontncharacters, and places them in the stringdestIn.

Declaration

Here is the declaration of the strxfrm() function.

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

Parameter

  • destdest -- Pointer to the destination array where the content is to be stored. If the argument n is 0, this can be a null pointer.
  • srcsrc -- The C string to be transformed according to the current locale.
  • n-- The maximum number of characters to be copied to str1.

Return Value

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

Example

The following example demonstrates the usage 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("字符串 |%s| 的长度是: |%d|", dest, len);
   
   return(0);
}

Let us compile and run the above program, this will produce the following result:

字符串 |W3C School| 的长度是: |10|

C Standard Library - <string.h>

other extensions