Skip to content

Commit 671037c

Browse files
committed
Add to_lowercase, starts_with, changes signature for contains
1 parent 9e04486 commit 671037c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/system/string.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ fn system_string_clone(this: &Il2CppString, method_info: OptionalMethod) -> &'_
4545
#[crate::from_offset("System", "String", "Contains")]
4646
fn system_string_contains(this: &Il2CppString, value: &Il2CppString, method_info: OptionalMethod) -> bool;
4747

48+
#[crate::from_offset("System", "String", "ToLower")]
49+
fn system_string_to_lower(this: &Il2CppString, method_info: OptionalMethod) -> &'_ mut Il2CppString;
50+
51+
#[crate::from_offset("System", "String", "StartsWith")]
52+
fn system_string_starts_with(this: &Il2CppString, value: &Il2CppString, method_info: OptionalMethod) -> bool;
53+
4854
#[crate::from_offset("System", "String", "Equals")]
4955
fn system_string_equals(a: &Il2CppString, b: &Il2CppString, method_info: OptionalMethod) -> bool;
5056

@@ -89,8 +95,16 @@ impl Il2CppString {
8995
}
9096
}
9197

92-
pub fn contains(&self, value: impl AsRef<str>) -> bool {
93-
unsafe { system_string_contains(self, value.as_ref().into(), None) }
98+
pub fn to_lowercase(&self) -> &'_ mut Il2CppString {
99+
unsafe { system_string_to_lower(self, None) }
100+
}
101+
102+
pub fn starts_with<'a>(&self, value: impl Into<&'a Il2CppString>) -> bool {
103+
unsafe { system_string_starts_with(self, value.into(), None) }
104+
}
105+
106+
pub fn contains<'a>(&self, value: impl Into<&'a Il2CppString>) -> bool {
107+
unsafe { system_string_contains(self, value.into(), None) }
94108
}
95109

96110
/// Provides a new instance of the Il2CppString, separate from the original.

0 commit comments

Comments
 (0)