windows-nt/Source/XPSP1/NT/shell/ext/ratings/common/chr.cpp
2020-09-26 16:20:57 +08:00

38 lines
859 B
C++

#include "npcommon.h"
// strchrf(str, ch)
//
// Returns a pointer to the first occurrence of ch in str.
// Returns NULL if not found.
// May search for a double-byte character.
LPSTR WINAPI strchrf(LPCSTR lpString, UINT ch)
{
while (*lpString) {
if (ch == (IS_LEAD_BYTE(*lpString) ? GetTwoByteChar(lpString) : *lpString))
return (LPSTR)lpString;
ADVANCE(lpString);
}
return NULL;
}
// strrchrf(str, ch)
//
// Returns a pointer to the last occurrence of ch in str.
// Returns NULL if not found.
// May search for a double-byte character.
LPSTR WINAPI strrchrf(LPCSTR lpString, UINT ch)
{
LPSTR lpLast = NULL;
while (*lpString) {
if (ch == (IS_LEAD_BYTE(*lpString) ? GetTwoByteChar(lpString) : *lpString))
lpLast = (LPSTR)lpString;
ADVANCE(lpString);
}
return lpLast;
}