mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-02-20 15:14:26 +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 {
|
bool String::to_bool() const {
|
||||||
if (_size == 0) {
|
if (_size == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -97,6 +97,9 @@ public:
|
|||||||
void append_repeat(const char* str, const int times);
|
void append_repeat(const char* str, const int times);
|
||||||
void append_repeat(const String &other, 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;
|
bool to_bool() const;
|
||||||
float to_float() const;
|
float to_float() const;
|
||||||
double to_double() const;
|
double to_double() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user