diff options
Diffstat (limited to 'core/string')
-rw-r--r-- | core/string/ustring.cpp | 2 | ||||
-rw-r--r-- | core/string/ustring.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp index 7cd1a39d38..3d37e17ef8 100644 --- a/core/string/ustring.cpp +++ b/core/string/ustring.cpp @@ -3964,7 +3964,7 @@ String String::format(const Variant &values, const String &placeholder) const { Variant v_val = values_arr[i]; String val = v_val; - if (placeholder.find("_") > -1) { + if (placeholder.contains("_")) { new_string = new_string.replace(placeholder.replace("_", i_as_str), val); } else { new_string = new_string.replace_first(placeholder, val); diff --git a/core/string/ustring.h b/core/string/ustring.h index a020c7d372..9df2d56e80 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -429,6 +429,8 @@ public: _FORCE_INLINE_ bool is_empty() const { return length() == 0; } _FORCE_INLINE_ bool contains(const char *p_str) const { return find(p_str) != -1; } _FORCE_INLINE_ bool contains(const String &p_str) const { return find(p_str) != -1; } + _FORCE_INLINE_ bool containsn(const char *p_str) const { return findn(p_str) != -1; } + _FORCE_INLINE_ bool containsn(const String &p_str) const { return findn(p_str) != -1; } // path functions bool is_absolute_path() const; |