NWLstrxfrm

Transforms a string by replacing each character with its corresponding collation value

NetWare Server:4.x, 5.x, 6.x
Platform:NLM, Windows NT, Windows 95, Windows 98
Library:Cross-Platform Localization (LOC*.*)
Service:Internationalization

Syntax

  #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); 
  
  

Pascal Syntax

  uses netwin32 
   
  Function NWLstrxfrm 
    (string1  : pnstr; 
     string2  : pnstr; 
     numBytes : size_t 
  ) : size_t; 
  
  

Parameters

string1
(OUT) Points to the string after it is transformed to its collation value (optional).
string2
(IN) Points to the string to be transformed.
numBytes
(IN) Specifies the size of the output buffer in bytes (including the NULL terminator).

Return Values

0x0000

String not transformed

non-zero

Length of the complete transformed string (not just the part of the string that fits in the output buffer).

Remarks

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.

See Also

NWGetCollateTableNWLsetlocale, NWLstrcoll