-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrCompare.h
More file actions
25 lines (24 loc) · 737 Bytes
/
strCompare.h
File metadata and controls
25 lines (24 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef STRINGFUNCTIONS_STRCOMPARE
#define STRINGFUNCTIONS_STRCOMPARE
bool c_StringFunctions::strCompare(const mystr str1,const mystr str2){
if(str1==NULL || str2==NULL)return false;
int i=0;
while(str1[i]!=STRING_END && str2[i]!=STRING_END){
if(str1[i]!=str2[i])return false;
i++;
}
if(str1[i]==STRING_END && str2[i]==STRING_END)return true;
return false;
}
bool c_StringFunctions::strCompare(const mystr str1,const mystr str2,const int len){
if(str1==NULL || str2==NULL)return false;
int i=0;
while(str1[i]!=STRING_END && str2[i]!=STRING_END){
if(str1[i]!=str2[i])return false;
i++;
if(i==len)return true;
}
if(str1[i]==STRING_END && str2[i]==STRING_END)return true;
return false;
}
#endif