summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-07 19:58:36 +0100
committerGitHub <noreply@github.com>2019-01-07 19:58:36 +0100
commit270eae0a05bbcb3795bca63217d0c969c4c9a234 (patch)
tree5480e3214e237a11049275b9be1515647a3f7b27 /core/ustring.cpp
parentf8eaa2fc596f33fb18d12b6a4b6d0a53d1baeee8 (diff)
parentcbb396c0064d77ec50a524241d22746c8b69bbdb (diff)
Merge pull request #24823 from ibrahn/fix-string-lrstrip-2
Repair String lstrip and rstrip.
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 311aa52d40..c1888c87a7 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2393,6 +2393,10 @@ int String::find(const char *p_str, int p_from) const {
return -1;
}
+int String::find_char(CharType p_char, int p_from) const {
+ return _cowdata.find(p_char, p_from);
+}
+
int String::findmk(const Vector<String> &p_keys, int p_from, int *r_key) const {
if (p_from < 0)
@@ -3063,7 +3067,7 @@ String String::lstrip(const String &p_chars) const {
for (beg = 0; beg < len; beg++) {
- if (p_chars.find(&ptr()[beg]) == -1)
+ if (p_chars.find_char(get(beg)) == -1)
break;
}
@@ -3080,7 +3084,7 @@ String String::rstrip(const String &p_chars) const {
for (end = len - 1; end >= 0; end--) {
- if (p_chars.find(&ptr()[end]) == -1)
+ if (p_chars.find_char(get(end)) == -1)
break;
}