CharPrevA function

Retrieves a pointer to the preceding character in a string. This function can handle strings consisting of either single- or multi-byte characters.

Syntax

LPSTR CharPrevA(
  LPCSTR lpszStart,
  LPCSTR lpszCurrent
);

Parameters

lpszStart

Type: LPCTSTR

The beginning of the string.

lpszCurrent

Type: LPCTSTR

A character in a null-terminated string.

Return Value

Type: LPTSTR

The return value is a pointer to the preceding character in the string, or to the first character in the string if the lpszCurrent parameter equals the lpszStart parameter.

Remarks

When called as an ANSI function, CharPrev uses the system default code-page, whereas CharPrevExA specifies a code-page to use.

This function works with default "user" expectations of characters when dealing with diacritics. For example: A string that contains U+0061 U+030a "LATIN SMALL LETTER A" + COMBINING RING ABOVE" — which looks like "å", will advance two code points, not one. A string that contains U+0061 U+0301 U+0302 U+0303 U+0304 — which looks like "a´^~¯", will advance five code points, not one, and so on.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

CharNext

CharNextExA

CharPrevExA

Conceptual

Reference

Strings