FoldString (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function maps one string to another, performing a specified transformation option.

int FoldString(
  DWORD dwMapFlags, 
  LPCTSTR lpSrcStr, 
  int cchSrc, 
  LPTSTR lpDestStr, 
  int cchDest 


[in] Value that specifies the type of transformation to be used during mapping. This value can be a combination of the following bit-flag constants. The following table shows the values this parameter can take.
MAP_FOLDCZONEFold compatibility zone characters into standard Unicode equivalents. For information about compatibility zone characters, see the following Remarks section.
MAP_FOLDDIGITSMap all digits to Unicode characters 0 through 9.
MAP_PRECOMPOSEDMap accented characters to precomposed characters, in which the accent and base character are combined into a single character value. This value cannot be combined with MAP_COMPOSITE.
MAP_COMPOSITEMap accented characters to composite characters, in which the accent and base character are represented by two character values. This value cannot be combined with MAP_PRECOMPOSED.
[in] Pointer to the string to be mapped.
[in] Size, in characters, of the lpSrcStr buffer. If cchSrc is –1, lpSrcStr is assumed to be null-terminated, and the length is calculated automatically.
[out] Pointer to the buffer to store the mapped string.
[in] Size, in characters, of the lpDestStr buffer. If cchDest is zero, the function returns the number of bytes or characters required to hold the mapped string, and the buffer pointed to by lpDestStr is not used.

Return Values

The number of bytes (ANSI version) or characters (Unicode version) written to the destination buffer, or, if the cchDest parameter is zero, the number of bytes or characters required to hold the mapped string indicates success. Zero indicates failure. To get extended error information, call the GetLastError function. The following table shows possible return values for the GetLastError function.

ERROR_INSUFFICIENT_BUFFERThe data area passed to a system call is too small.
ERROR_INVALID_FLAGSThe flags are invalid.
ERROR_INVALID_PARAMETERThe parameter is incorrect.


The mapped string is null-terminated if the source string is null-terminated.

The lpSrcStr and lpDestStr pointers must not be the same. If they are the same, the function fails and GetLastError returns ERROR_INVALID_PARAMETER.

The compatibility zone in Unicode consists of characters in the range 0xF900 through 0xFFEF that are assigned to characters from other character-encoding standards but are actually variants of characters that are already in Unicode. The compatibility zone is used to support round-trip mapping to these standards. Applications can use the MAP_FOLDCZONE flag to avoid supporting the duplication of characters in the compatibility zone.


OS Versions: Windows CE 1.0 and later.
Header: Winnls.h.
Link Library: Coreloc.lib.

See Also

CompareString | LCMapString

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.

© 2015 Microsoft