mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
Added append_repeat to the string.
This commit is contained in:
parent
2dac93662c
commit
1237d3da2a
@ -542,6 +542,17 @@ void String::append_str(const std::string &str) {
|
||||
_data[_size] = '\0';
|
||||
}
|
||||
|
||||
void String::append_repeat(const char *str, const int times) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
append_str(str);
|
||||
}
|
||||
}
|
||||
void String::append_repeat(const String &other, const int times) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
append_str(other);
|
||||
}
|
||||
}
|
||||
|
||||
float String::to_float() const {
|
||||
return atof(c_str());
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ public:
|
||||
void append_str(const String &other);
|
||||
void append_str(const std::string &str);
|
||||
|
||||
void append_repeat(const char* str, const int times);
|
||||
void append_repeat(const String &other, const int times);
|
||||
|
||||
float to_float() const;
|
||||
double to_double() const;
|
||||
int to_int() const;
|
||||
|
Loading…
Reference in New Issue
Block a user