diff options
Diffstat (limited to 'src/querymanager.cc')
| -rw-r--r-- | src/querymanager.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/querymanager.cc b/src/querymanager.cc index 25fdfb2..350b708 100644 --- a/src/querymanager.cc +++ b/src/querymanager.cc @@ -164,6 +164,28 @@ bool StringEqCI(const char *A, const char *B){ } } +bool StringStartsWith(const char *String, const char *Prefix){ + int Index = 0; + while(Prefix[Index] != 0){ + if(String[Index] == 0 || String[Index] != Prefix[Index]){ + return false; + } + Index += 1; + } + return true; +} + +bool StringStartsWithCI(const char *String, const char *Prefix){ + int Index = 0; + while(Prefix[Index] != 0){ + if(String[Index] == 0 || tolower(String[Index]) != tolower(Prefix[Index])){ + return false; + } + Index += 1; + } + return true; +} + bool StringCopyN(char *Dest, int DestCapacity, const char *Src, int SrcLength){ ASSERT(DestCapacity > 0); bool Result = (SrcLength < DestCapacity); |
