aboutsummaryrefslogtreecommitdiff
path: root/common/str.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/str.cpp')
-rw-r--r--common/str.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp
index e8e73a32a2..ffb8c298b0 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -160,6 +160,16 @@ void String::deleteLastChar() {
}
}
+void String::deleteChar(int p)
+{
+ if (p >= 0 && p < _len) {
+ ensureCapacity(_len - 1, true);
+ while (p++ < _len)
+ _str[p-1] = _str[p];
+ _len--;
+ }
+}
+
void String::clear()
{
if (_capacity) {
@@ -172,6 +182,17 @@ void String::clear()
}
}
+void String::insertChar(char c, int p)
+{
+ if (p >= 0 && p <= _len) {
+ ensureCapacity(++_len, true);
+ for (int i = _len; i > p; i--) {
+ _str[i] = _str[i-1];
+ }
+ _str[p] = c;
+ }
+}
+
void String::toLowercase()
{
if (_str == 0 || _len == 0)