mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
859 B
37 lines
859 B
#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;
|
|
}
|
|
|