Skip to content

Commit 9e04486

Browse files
committed
Add Il2CppString::contains
1 parent b50c75b commit 9e04486

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/system/string.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ fn system_string_copy(string: &Il2CppString, method_info: OptionalMethod) -> &'_
4242
#[crate::from_offset("System", "String", "Clone")]
4343
fn system_string_clone(this: &Il2CppString, method_info: OptionalMethod) -> &'_ mut Il2CppString;
4444

45+
#[crate::from_offset("System", "String", "Contains")]
46+
fn system_string_contains(this: &Il2CppString, value: &Il2CppString, method_info: OptionalMethod) -> bool;
47+
4548
#[crate::from_offset("System", "String", "Equals")]
4649
fn system_string_equals(a: &Il2CppString, b: &Il2CppString, method_info: OptionalMethod) -> bool;
4750

@@ -86,6 +89,10 @@ impl Il2CppString {
8689
}
8790
}
8891

92+
pub fn contains(&self, value: impl AsRef<str>) -> bool {
93+
unsafe { system_string_contains(self, value.as_ref().into(), None) }
94+
}
95+
8996
/// Provides a new instance of the Il2CppString, separate from the original.
9097
pub fn clone(&self) -> &'_ Il2CppString {
9198
// Yes.

0 commit comments

Comments
 (0)