libobs: Add wstrstri function
Performs a case-insensitive search for a wide-character string within another wide-character string.
This commit is contained in:
parent
9a91bbc16c
commit
a87fe6d783
@ -179,6 +179,23 @@ char *astrstri(const char *str, const char *find)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wchar_t *wstrstri(const wchar_t *str, const wchar_t *find)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (!str || !find)
|
||||
return NULL;
|
||||
|
||||
len = wcslen(find);
|
||||
|
||||
do {
|
||||
if (wstrcmpi_n(str, find, len) == 0)
|
||||
return (wchar_t*)str;
|
||||
} while (*str++);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *strdepad(char *str)
|
||||
{
|
||||
char *temp;
|
||||
|
@ -47,6 +47,7 @@ EXPORT int astrcmpi_n(const char *str1, const char *str2, size_t n);
|
||||
EXPORT int wstrcmpi_n(const wchar_t *str1, const wchar_t *str2, size_t n);
|
||||
|
||||
EXPORT char *astrstri(const char *str, const char *find);
|
||||
EXPORT wchar_t *wstrstri(const wchar_t *str, const wchar_t *find);
|
||||
|
||||
EXPORT char *strdepad(char *str);
|
||||
EXPORT wchar_t *wcsdepad(wchar_t *str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user