jak2: significantly reduce the verbosity of the game.gp file (#2103)

This commit is contained in:
Tyler Wilding
2023-01-28 20:15:58 -05:00
committed by GitHub
parent 18507bc78e
commit 3d097e69e1
12 changed files with 548 additions and 4574 deletions
+3 -6
View File
@@ -13,15 +13,12 @@ bool contains(const std::string& s, const std::string& substr) {
}
bool starts_with(const std::string& s, const std::string& prefix) {
return s.rfind(prefix) == 0;
return s.size() >= prefix.size() && 0 == s.compare(0, prefix.size(), prefix);
}
bool ends_with(const std::string& s, const std::string& suffix) {
if (s.length() >= suffix.length()) {
return !s.compare(s.length() - suffix.length(), suffix.length(), suffix);
} else {
return false;
}
return s.size() >= suffix.size() &&
0 == s.compare(s.size() - suffix.size(), suffix.size(), suffix);
}
std::string ltrim(const std::string& s) {