summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-08 14:35:41 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-08 14:35:41 +0200
commit1d101329c96460a8b00a8dec5ff8808a589ee505 (patch)
tree8ce42d41056496dbcfad89ef871b9469f259f98e /core
parentb8255b148fdd48822aa256f7a7ba05c85341bcde (diff)
parentb4c6cc7d82d1fcdb3bed734c4e22c19e012c84df (diff)
downloadredot-engine-1d101329c96460a8b00a8dec5ff8808a589ee505.tar.gz
Merge pull request #91611 from AThousandShips/string_containsn
[Core] Add case-insensitive `String::containsn`
Diffstat (limited to 'core')
-rw-r--r--core/string/ustring.h2
-rw-r--r--core/variant/variant_call.cpp1
2 files changed, 3 insertions, 0 deletions
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;
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index c5861f3fbb..9b7777f480 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1707,6 +1707,7 @@ static void _register_variant_builtin_methods() {
bind_string_method(sha256_buffer, sarray(), varray());
bind_string_method(is_empty, sarray(), varray());
bind_string_methodv(contains, static_cast<bool (String::*)(const String &) const>(&String::contains), sarray("what"), varray());
+ bind_string_methodv(containsn, static_cast<bool (String::*)(const String &) const>(&String::containsn), sarray("what"), varray());
bind_string_method(is_absolute_path, sarray(), varray());
bind_string_method(is_relative_path, sarray(), varray());