Added 2 new path slash related helper methods to string.

This commit is contained in:
Relintai 2022-02-06 09:58:48 +01:00
parent 3fa13484c0
commit 6d6735717b
2 changed files with 13 additions and 0 deletions

View File

@ -1043,6 +1043,17 @@ void String::append_path(const String &path) {
}
}
void String::path_clean_end_slash() {
while (ends_with('/') || ends_with('\\')) {
pop_back();
}
}
void String::path_ensure_end_slash() {
if (!(ends_with('/') || ends_with('\\'))) {
push_back(DEFAULT_DIRECTORY_SEPARATOR);
}
}
void String::to_html_special_chars() {
replace("&", "&");
replace("\"", """);

View File

@ -109,6 +109,8 @@ public:
void append_path(const char* path);
void append_path(const String &path);
void path_clean_end_slash();
void path_ensure_end_slash();
void to_html_special_chars();
void from_html_special_chars();