summaryrefslogtreecommitdiffstats
path: root/core/ustring.cpp
diff options
context:
space:
mode:
authorStijn Hinlopen <f.a.hinlopen@gmail.com>2020-07-03 15:26:22 +0200
committerStijn Hinlopen <f.a.hinlopen@gmail.com>2020-07-03 15:26:22 +0200
commit929b98d24b53789b3e3fbbae90aed0fe0e72b409 (patch)
tree89156a4e626da2bef5305bee55d785f5e77aec46 /core/ustring.cpp
parentfd5b6e1db24facfbb6d5e9175b8e512c25fbde1d (diff)
downloadredot-engine-929b98d24b53789b3e3fbbae90aed0fe0e72b409.tar.gz
Remove String::find_last (same as rfind)
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r--core/ustring.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 0b44f0c056..5d3cf5f1a4 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2280,18 +2280,6 @@ String String::substr(int p_from, int p_chars) const {
return s;
}
-int String::find_last(const String &p_str) const {
- int pos = -1;
- int findfrom = 0;
- int findres = -1;
- while ((findres = find(p_str, findfrom)) != -1) {
- pos = findres;
- findfrom = pos + 1;
- }
-
- return pos;
-}
-
int String::find(const String &p_str, int p_from) const {
if (p_from < 0) {
return -1;
@@ -2582,7 +2570,7 @@ int String::rfindn(const String &p_str, int p_from) const {
}
bool String::ends_with(const String &p_string) const {
- int pos = find_last(p_string);
+ int pos = rfind(p_string);
if (pos == -1) {
return false;
}
@@ -3831,7 +3819,7 @@ String String::get_base_dir() const {
}
}
- int sep = MAX(rs.find_last("/"), rs.find_last("\\"));
+ int sep = MAX(rs.rfind("/"), rs.rfind("\\"));
if (sep == -1) {
return base;
}
@@ -3840,7 +3828,7 @@ String String::get_base_dir() const {
}
String String::get_file() const {
- int sep = MAX(find_last("/"), find_last("\\"));
+ int sep = MAX(rfind("/"), rfind("\\"));
if (sep == -1) {
return *this;
}
@@ -3849,8 +3837,8 @@ String String::get_file() const {
}
String String::get_extension() const {
- int pos = find_last(".");
- if (pos < 0 || pos < MAX(find_last("/"), find_last("\\"))) {
+ int pos = rfind(".");
+ if (pos < 0 || pos < MAX(rfind("/"), rfind("\\"))) {
return "";
}
@@ -3938,8 +3926,8 @@ String String::property_name_encode() const {
}
String String::get_basename() const {
- int pos = find_last(".");
- if (pos < 0 || pos < MAX(find_last("/"), find_last("\\"))) {
+ int pos = rfind(".");
+ if (pos < 0 || pos < MAX(rfind("/"), rfind("\\"))) {
return *this;
}