mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
* libstd: Initial standard library work bit operations, fixed point, numeric limits and math functions * libstd: Added ctype, rustint, stdint and string library, expand bit, fxpt and math library * patterns: Drastically improve ELF pattern * patterns: Added atmosphere AFE2 * patterns: tabs -> spaces * patterns: Added archive file pattern
30 lines
754 B
Plaintext
30 lines
754 B
Plaintext
namespace std::string {
|
|
|
|
fn to_string(auto x) {
|
|
return std::format("{}", x);
|
|
};
|
|
|
|
fn starts_with(str string, str part) {
|
|
return std::string::substr(string, 0, std::string::length(part)) == part;
|
|
};
|
|
|
|
fn ends_with(str string, str part) {
|
|
return std::string::substr(string, std::string::length(string) - std::string::length(part), std::string::length(part)) == part;
|
|
};
|
|
|
|
fn contains(str a, str b) {
|
|
s32 a_len, b_len;
|
|
a_len = std::string::length(a);
|
|
b_len = std::string::length(b);
|
|
|
|
s32 i;
|
|
while (i < a_len - b_len) {
|
|
if (std::string::substr(a, i, b_len) == b)
|
|
return true;
|
|
i = i + 1;
|
|
}
|
|
|
|
return false;
|
|
};
|
|
|
|
} |