add TextIsEqualCase and use in IsFileExtension
This commit is contained in:
parent
c20ccfe274
commit
6885f53fbb
|
|
@ -1845,7 +1845,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
|
|||
|
||||
for (int i = 0; i < extCount; i++)
|
||||
{
|
||||
if (strcmp(fileExt, checkExts[i] + 1) == 0)
|
||||
if (TextIsEqualCase(fileExt, checkExts[i] + 1))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1196,6 +1196,7 @@ RLAPI int GetGlyphIndex(Font font, int codepoint);
|
|||
// Text strings management functions (no utf8 strings, only byte chars)
|
||||
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
|
||||
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
|
||||
RLAPI bool TextIsEqualCase(const char *text1, const char *text2); // Check if two text strings are equal ignoring case
|
||||
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
|
||||
RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf style)
|
||||
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
|
||||
|
|
|
|||
17
src/text.c
17
src/text.c
|
|
@ -1108,6 +1108,23 @@ bool TextIsEqual(const char *text1, const char *text2)
|
|||
|
||||
return result;
|
||||
}
|
||||
// Check if two text string are equal ignoring case
|
||||
// REQUIRES: tolower()
|
||||
bool TextIsEqualCase(const char *text1, const char *text2)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
while (tolower((unsigned char)(*text1)) == tolower((unsigned char)(*text2++)))
|
||||
{
|
||||
if(*text1++ == '\0')
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get text length in bytes, check for \0 character
|
||||
unsigned int TextLength(const char *text)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user