C - strxfrm() function
C strxfrm() function - String transformation
Syntax:
size_t strxfrm(char *string1, const char *string2, size_t count)
The strxfrm() function is used to transform the string pointed to by string2 and places the result into the string pointed to by string1. The transformation is determined by the program's current locale.
Parameters:
Name | Description | Required /Optional |
---|---|---|
string1 | Destination string. | Required |
string2 | Source string. | Required |
count | Maximum number of characters to place in string1.. | Required |
Return value from strxfrm()
- This function returns the length of the transformed string, not including the terminating null-character.
Example: strxfrm() function
#include <stdio.h>
#include <string.h>
int main(void)
{
char *string1, buffer[80];
int length;
printf("Length of the array is 80 where you input a string:");
printf("\n\nInput a string of characters:\n");
string1 = gets(buffer);
length = strxfrm(NULL, string1, 0);
printf("\nThis would require %d element array to hold the string.",length);
}
Output:
Length of the array is 80 where you input a string: Input a string of characters: C Programming This would require 13 element array to hold the string.
C Programming Code Editor:
Previous C Programming: C strtok()
Next C Programming:C string.h Home
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics