mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 08:47:28 +01:00
27 lines
537 B
C++
27 lines
537 B
C++
#include "utility.h"
|
|
#include <string.h>
|
|
|
|
namespace reader
|
|
{
|
|
|
|
bool stringEndsWith(const char* str, const char* pattern)
|
|
{
|
|
int strLength = strlen(str);
|
|
int patternLength = strlen(pattern);
|
|
if (patternLength > strLength)
|
|
return false;
|
|
|
|
const char* strIter = str + strlen(str);
|
|
const char* patternIter = pattern + strlen(pattern);
|
|
|
|
while(*strIter == *patternIter)
|
|
{
|
|
if(patternIter == pattern)
|
|
return true;
|
|
strIter--;
|
|
patternIter--;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} |