.TH strxfrm() "" "" "String Function (libc)"
.PC "Transform a string using locale information"
.B "#include <string.h>"
\fBunsigned int strxfrm(\fIstring1\^\fB, \fIstring2\^\fB, \fIn\^\fB)\fR
\fBchar *\fIstring1\^\fB, *\fIstring2\^\fB; unsigned int \fIn\^\fB;\fR
.PP
.II "transform a string"
.II "string transformation, locale specific"
.II "locale-specific string transformation"
.B strxfrm()
transforms
.I string2
using information concerning the program's locale,
as set by the function
.BR setlocale() .
It then writes up to
.I n
bytes of the transformed result into the area to which
.I string1
points.
It returns the length of the transformed string, not including the
terminating null character.
The transformation incorporates locale-specific material into
.IR string1 .
.PP
If
.I n
is set to zero,
.B strxfrm()
returns the length of the transformed string.
.PP
If two strings return a given result when compared by
.B strcoll()
before transformation,
they will return the same result when compared by
.B strcmp()
after transformation.
.SH Example
The following simple program demonstrates
.BR strxfrm() :
.DM
#include <stdio.h>
#include <string.h>
.DE
.DM
main()
{
	char string1[20], string2[20];
.DE
.DM
	strcpy (string1, "This is string 1");
	strcpy (string2, "This is string 2");
.DE
.DM
	printf ("String 1 before transformation: %s\en", string1);
	printf ("String 2 before transformation: %s\en", string2);
.DE
.DM
	strxfrm (string1, string2, 18);
.DE
.DM
	printf ("String 1 after transformation: %s\en", string1);
	printf ("String 2 after transformation: %s\en", string2);
}
.DE
.SH "See Also"
.Xr "libc," libc
.Xr "string.h" string.h
.br
\*(AS, \(sc7.11.4.5
.SH Notes
If
.B strxfrm()
returns a value equal to or greater than
.IR n ,
the contents of the area to which
.I string1
points are indeterminate.
.\".PP
.\"\*(CO has not yet implemented the ANSI locale functions.
.\"Therefore,
.\".B strxfrm()
.\"behaves the same as
.\".BR strcpy() .
