Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C programming/string.h/strxfrm

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

strxfrm is a C Standard Library string function declared in string.h. It transforms string according to the current locale setting. The prototype of this function is: size_t strxfrm(char *str1 , const char *str2 , size_t num); Parameters str1 is the string which receives num characters of transformed string. If num is equal to zero then str1 contains only null character. str2 is the string which is to be transformed. num is the maximum number of characters which to be copied into str1. Description strxfrm() function transforms str2 according to the current locale setting.For that LC_COLLATE category is used which is defined in locale.h. After transformation, the first num characters of the transformed string is copied into str1. strxfrm() function performs transformation in such a way that result of strcmp on two strings is the same as result of strcoll on two original strings. Return Value strxfrm() function returns length of transformed string excluding terminating null character. Example usage #include <stdio.h> #include <string.h> int main(void) { char str2[] = "Hello World"; char str1[strlen(str2) + 1]; printf("The length of str2 = %d\n",strxfrm(str1, str2, 4)); printf("The content of str1 = %s\n", str1[]); printf("The content of str2 = %s\n", str2[]); return 0; } Output The length of str2 = 11 The content of str1 = Hell The content of str2 = Hello World External links 3 strxfrm C++ reference for std::strxfrm deep