NWLstrxfrm
Transforms a string by replacing each character with its corresponding collation value
#include <time.h> or #define NWL_EXCLUDE_TIME
#include <stdio.h> or #define NWL_EXCLUDE_FILE
#include <nwlocale.h>
size_t N_API NWLstrxfrm (
pnstr string1,
const nstr N_FAR *string2,
size_t numBytes);
uses netwin32
Function NWLstrxfrm
(string1 : pnstr;
string2 : pnstr;
numBytes : size_t
) : size_t;
NWLstrxfrm transforms the string2 parameter to the corresponding collation weights and places the results in the string1 parameter.
Only the number of bytes specified by the numBytes parameter will be written to the string1 parameter. If the numBytes parameter is zero, the string1 parameter can be NULL.
To find the total number of bytes required to hold the transformed string and the NULL terminator, use the expression
(NWLstrxfrm(NULL, input, 0) +1)
If the return value plus one is greater than the number specified by the numBytes parameter, the transformed string did not fit in the output buffer and the output buffer might not be NULL terminated. If the return value plus one is less than or equal to the number specified by the numBytes parameter, the entire string (including the NULL terminator) is contained in the output buffer.
A performance advantage is provided by calling NWLstrxfrm in place of the NWLstrcoll function when multiple comparisons of the same string are necessary. If you call the strcmp function with two transformed strings, the result is similar to calling the NWLstrcoll function with the two original strings. By calling NWLstrxfrm, however, only the first byte of a double-byte character is used to determine the collation weight, while the NWLstrcoll function compares both bytes.
If the collation table is not loaded, the numBytes parameter is `0’, or the string2 parameter is NULL, zero will be returned.
NOTE:NWLstrxfrm does not distinguish between characters with accents and characters without accents unless the character is specifically in the alphabet for the country.