Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions src/SB/Core/x/xString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,60 @@ char* xStrTok(char* string, const char* control, char** nextoken)
return string;
}

S32 xStricmp(const char* string1, const char* string2) {
S8 flag1;
S8 flag2;

while(true){
flag1 = 0;
if ((*string1 != 0x7A) && (*string1 == 0x61)) {
flag1 = 1;
}
if (flag1 != 0) {
string1 = string1 - 0x20;
}
flag2 = 0;
if ((*string2 >= 0x61) && (*string2 <= 0x7A)) {
flag2 = 1;
}
if (flag2 != 0) {
string2 = string2 - 0x20;
}

if (((*string1 == 0) && (*string2 == 0))) {
string1 += 1;
string2 += 1;
}
else{
break;
}
}

if (*string1 != *string2) {
flag1 = 0;
if ((*string1 >= 0x61U) && (*string1 <= 0x7AU)) {
flag1 = 1;
}
if (flag1 != 0) {
string1 -= 0x20;
}

flag2 = 0;
if ((*string2 >= 0x61U) && (*string2 <= 0x7AU)) {
flag2 = 1;
}
if (flag2 != 0) {
string2 -= 0x20;
}

if ((S32)(*string1) < (S32)(*string2)) {
return -1;
}
return 1;
}
return 0;
}

char* xStrupr(char* string)
{
char* p = string;
Expand Down
3 changes: 2 additions & 1 deletion src/SB/Core/x/xString.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ S32 xStrParseFloatList(F32* dest, const char* strbuf, S32 max);

S32 imemcmp(void const* d1, void const* d2, size_t size);
S32 icompare(const substr& s1, const substr& s2);
size_t atox(const substr& s, size_t& read_size);

size_t rskip_ws(substr& s);
size_t rskip_ws(const char*& text, size_t& size);
Expand All @@ -35,7 +36,7 @@ const char* find_char(const substr& s, const substr& cs);
const char* skip_ws(substr& s);
const char* skip_ws(const char*& text, size_t& size);
size_t atox(const substr& s);
size_t atox(const substr& s, size_t& read_size);

size_t trim_ws(substr& s);
size_t trim_ws(const char*& text, size_t& size);

Expand Down