startsWith() & endsWith()
This commit is contained in:
parent
982a79a052
commit
eca678026f
@ -34,3 +34,16 @@ char* char_multiply(char c, uint32 n){
|
|||||||
rez[n]=c;
|
rez[n]=c;
|
||||||
return rez;
|
return rez;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cptr_startsWith(char* ptr, char* fragment){
|
||||||
|
for(char cs=*ptr, cf=*fragment; cf; cs=*++ptr, cf=*++fragment)
|
||||||
|
if(cs!=cf) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool cptr_endsWith(char* ptr, char* fragment){
|
||||||
|
ptr+=cptr_length(ptr)-cptr_length(fragment);
|
||||||
|
for(char cs=*ptr, cf=*fragment; cf; cs=*++ptr, cf=*++fragment)
|
||||||
|
if(cs!=cf) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@ -18,6 +18,10 @@ bool cptr_compare(char* key0, char* key1);
|
|||||||
// multiplies char n times
|
// multiplies char n times
|
||||||
char* char_multiply(char c, uint32 n);
|
char* char_multiply(char c, uint32 n);
|
||||||
|
|
||||||
|
bool cptr_startsWith(char* ptr, char* fragment);
|
||||||
|
|
||||||
|
bool cptr_endsWith(char* ptr, char* fragment);
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user