mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
committed by
Bhupendra Aole
parent
00aabec8bb
commit
073f625a91
@@ -3049,6 +3049,22 @@ String String::replacen(const String &p_key, const String &p_with) const {
|
||||
return new_string;
|
||||
}
|
||||
|
||||
String String::repeat(int p_count) const {
|
||||
|
||||
ERR_FAIL_COND_V_MSG(p_count < 0, "", "Parameter count should be a positive number.");
|
||||
|
||||
String new_string;
|
||||
const CharType *src = this->c_str();
|
||||
|
||||
new_string.resize(length() * p_count + 1);
|
||||
|
||||
for (int i = 0; i < p_count; i++)
|
||||
for (int j = 0; j < length(); j++)
|
||||
new_string[i * length() + j] = src[j];
|
||||
|
||||
return new_string;
|
||||
}
|
||||
|
||||
String String::left(int p_pos) const {
|
||||
|
||||
if (p_pos <= 0)
|
||||
|
||||
Reference in New Issue
Block a user