ssttrrxxffrrmm() -- String Function (libc)

Transform a string
#iinncclluuddee <ssttrriinngg.hh>
uunnssiiggnneedd iinntt ssttrrxxffrrmm(_s_t_r_i_n_g_1, _s_t_r_i_n_g_2, _n)
cchhaarr *_s_t_r_i_n_g_1, *_s_t_r_i_n_g_2; uunnssiiggnneedd iinntt _n;

ssttrrxxffrrmm()  transforms _s_t_r_i_n_g_2  using information  concerning  the program's
locale, as set by the function sseettllooccaallee(). It then writes up to _n bytes of
the transformed  result into the area to which  _s_t_r_i_n_g_1 points.  It returns
the length  of the transformed  string, not including  the terminating null
character.  The  transformation incorporates locale-specific  material into
_s_t_r_i_n_g_1.

If  _n is  set to  zero,  ssttrrxxffrrmm() returns  the length  of the  transformed
string.

If  two strings  return a  given result when  compared by  ssttrrccoollll() before
transformation, they will return  the same result when compared by ssttrrccmmpp()
after transformation.

_E_x_a_m_p_l_e
The following simple program demonstrates ssttrrxxffrrmm():

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

main()
{
    char string1[20], string2[20];

    strcpy (string1, "This is string 1");
    strcpy (string2, "This is string 2");

    printf ("String 1 before transformation: %s\n", string1);
    printf ("String 2 before transformation: %s\n", string2);

    strxfrm (string1, string2, 18);

    printf ("String 1 after transformation: %s\n", string1);
    printf ("String 2 after transformation: %s\n", string2);
}

_S_e_e _A_l_s_o
lliibbcc, ssttrriinngg.hh
ANSI Standard, section 7.11.4.5

_N_o_t_e_s
If ssttrrxxffrrmm()  returns a value equal  to or greater than  _n, the contents of
the area to which _s_t_r_i_n_g_1 points are indeterminate.

COHERENT  has not  yet implemented the  ANSI locale  functions.  Therefore,
ssttrrxxffrrmm() behaves the same as ssttrrccppyy().
