mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-04 15:55:51 +00:00
hecl/hecl: Amend string functions operating on string views to use interface functions
We don't really need to call out to the C functions to perform the comparison behavior when the views already have a comparison function as part of their interface.
This commit is contained in:
parent
e0b5a4e2f7
commit
ef6b41ea15
@ -1037,13 +1037,13 @@ public:
|
|||||||
static bool BeginsWith(SystemStringView str, SystemStringView test) {
|
static bool BeginsWith(SystemStringView str, SystemStringView test) {
|
||||||
if (test.size() > str.size())
|
if (test.size() > str.size())
|
||||||
return false;
|
return false;
|
||||||
return !StrNCmp(str.data(), test.data(), test.size());
|
return str.compare(0, test.size(), test) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool EndsWith(SystemStringView str, SystemStringView test) {
|
static bool EndsWith(SystemStringView str, SystemStringView test) {
|
||||||
if (test.size() > str.size())
|
if (test.size() > str.size())
|
||||||
return false;
|
return false;
|
||||||
return !StrNCmp(&*(str.end() - test.size()), test.data(), test.size());
|
return str.compare(str.size() - test.size(), SystemStringView::npos, test) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string TrimWhitespace(std::string_view str) {
|
static std::string TrimWhitespace(std::string_view str) {
|
||||||
@ -1060,13 +1060,13 @@ public:
|
|||||||
static bool BeginsWith(std::string_view str, std::string_view test) {
|
static bool BeginsWith(std::string_view str, std::string_view test) {
|
||||||
if (test.size() > str.size())
|
if (test.size() > str.size())
|
||||||
return false;
|
return false;
|
||||||
return !strncmp(str.data(), test.data(), test.size());
|
return str.compare(0, test.size(), test) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool EndsWith(std::string_view str, std::string_view test) {
|
static bool EndsWith(std::string_view str, std::string_view test) {
|
||||||
if (test.size() > str.size())
|
if (test.size() > str.size())
|
||||||
return false;
|
return false;
|
||||||
return !strncmp(&*(str.end() - test.size()), test.data(), test.size());
|
return str.compare(str.size() - test.size(), std::string_view::npos, test) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SystemString TrimWhitespace(SystemStringView str) {
|
static SystemString TrimWhitespace(SystemStringView str) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user