added a few functions to string and added some logs to string
This commit is contained in:
parent
eaef5a584b
commit
d64340525a
2 changed files with 27 additions and 0 deletions
|
|
@ -100,6 +100,18 @@ uint8_t ARC_String_EqualsCString(ARC_String *string, const char *cstring, uint64
|
|||
return 1;
|
||||
}
|
||||
|
||||
uint8_t ARC_String_SubstringEqualsCString(ARC_String *string, uint64_t offset, const char *cstring, uint64_t length){
|
||||
if(string->length - offset < length){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(strncmp(string->data + offset, cstring, length)){
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t ARC_String_Alpha(ARC_String *string){
|
||||
for(uint64_t length = string->length; length; length--){
|
||||
if(string->data[length - 1] >= 'a' && string->data[length - 1] <= 'z'){
|
||||
|
|
@ -131,6 +143,7 @@ double ARC_String_ToDouble(ARC_String *string){
|
|||
|
||||
uint64_t ARC_String_Find(ARC_String *string, ARC_String *substring){
|
||||
if(!string || !substring){
|
||||
ARC_DEBUG_ERR("ARC_String_Find(string, substring), string or substring was null");
|
||||
arc_errno = ARC_ERRNO_NULL;
|
||||
return ~(uint64_t)0;
|
||||
}
|
||||
|
|
@ -152,6 +165,7 @@ uint64_t ARC_String_Find(ARC_String *string, ARC_String *substring){
|
|||
uint64_t ARC_String_FindCString(ARC_String *string, const char *cstring, uint64_t length){
|
||||
if(!string || !cstring){
|
||||
arc_errno = ARC_ERRNO_NULL;
|
||||
ARC_DEBUG_ERR("ARC_String_FindCString(string, cstring, length), string or cstring was null");
|
||||
return ~(uint64_t)0;
|
||||
}
|
||||
|
||||
|
|
@ -172,6 +186,7 @@ uint64_t ARC_String_FindCString(ARC_String *string, const char *cstring, uint64_
|
|||
uint64_t ARC_String_FindBack(ARC_String *string, ARC_String *substring){
|
||||
if(!string || !substring){
|
||||
arc_errno = ARC_ERRNO_NULL;
|
||||
ARC_DEBUG_ERR("ARC_String_FindBack(string, substring), string or substring was null");
|
||||
return ~(uint64_t)0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue