mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Added html special chars methods to the string.
This commit is contained in:
parent
33be242319
commit
33ba5337b7
@ -915,6 +915,22 @@ void String::append_repeat(const String &other, const int times) {
|
||||
}
|
||||
}
|
||||
|
||||
void String::to_html_special_chars() {
|
||||
replace("&", "&");
|
||||
replace("\"", """);
|
||||
replace("'", "'");
|
||||
replace("<", "<");
|
||||
replace(">", ">");
|
||||
}
|
||||
|
||||
void String::from_html_special_chars() {
|
||||
replace("&", "&");
|
||||
replace(""", "\"");
|
||||
replace("'", "'");
|
||||
replace("<", "<");
|
||||
replace(">", ">");
|
||||
}
|
||||
|
||||
bool String::to_bool() const {
|
||||
if (_size == 0) {
|
||||
return 0;
|
||||
|
@ -97,6 +97,9 @@ public:
|
||||
void append_repeat(const char* str, const int times);
|
||||
void append_repeat(const String &other, const int times);
|
||||
|
||||
void to_html_special_chars();
|
||||
void from_html_special_chars();
|
||||
|
||||
bool to_bool() const;
|
||||
float to_float() const;
|
||||
double to_double() const;
|
||||
|
Loading…
Reference in New Issue
Block a user