You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**to_string**|`to_string(self) -> char*`|Maps to `c_str()`. Used for `{var}` interpolation. |
68
71
|**starts_with**|`starts_with(self, prefix: char*) -> bool`| Checks if the string starts with the given prefix. |
69
72
|**ends_with**|`ends_with(self, suffix: char*) -> bool`| Checks if the string ends with the given suffix. |
70
73
|**contains**|`contains(self, target: char) -> bool`| Checks if the string contains the given character. |
@@ -76,61 +79,62 @@ struct String {
76
79
77
80
### UTF-8 Support
78
81
79
-
These methods handle UTF-8 character boundaries correctly, contrasting with the byte-oriented methods above.
80
-
81
82
| Method | Signature | Description |
82
83
| :--- | :--- | :--- |
83
84
|**utf8_len**|`utf8_len(self) -> usize`| Returns the number of Unicode code points (characters). |
84
-
|**utf8_at**|`utf8_at(self, idx: usize) -> String`| Returns the character at the specified *character index* as a new String. |
85
-
|**utf8_get**|`utf8_get(self, idx: usize) -> rune`| Returns the character at the specified *character index* as a `rune`. |
86
-
|**utf8_substr**|`utf8_substr(self, start_idx: usize, num_chars: usize) -> String`| Returns a substring based on character indices and character count. |
87
-
|**runes**|`runes(self) -> Vec<rune>`| Returns a vector containing all Unicode code points from the string. |
88
-
|**from_runes_vec**|`String::from_runes_vec(runes: Vec<rune>) -> String`| Creates a new String from a vector of `rune` objects. |
89
-
|**chars**|`chars(self) -> StringCharsIter`| Returns an iterator that yields `Option<rune>` for each character. |
90
-
85
+
|**utf8_at**|`utf8_at(self, idx: usize) -> String`| Returns the character at the specified index as a new String. |
86
+
|**utf8_get**|`utf8_get(self, idx: usize) -> rune`| Returns the character at the specified index as a `rune`. |
87
+
|**utf8_substr**|`utf8_substr(self, start_idx: usize, num_chars: usize) -> String`| Returns a substring based on character indices. |
88
+
|**runes**|`runes(self) -> Vec<rune>`| Returns a vector containing all Unicode code points. |
89
+
|**chars**|`chars(self) -> StringCharsIter`| Returns a manual iterator yielding `Option<rune>`. |
91
90
92
91
### Transformations
93
92
94
93
| Method | Signature | Description |
95
94
| :--- | :--- | :--- |
96
95
|**to_lowercase**|`to_lowercase(self) -> String`| Returns a new string converted into lowercase. |
97
96
|**to_uppercase**|`to_uppercase(self) -> String`| Returns a new string converted into uppercase. |
98
-
|**split**|`split(self, delim: char) -> Vec<String>`| Splits the string into a vector of substrings separated by `delim`. |
99
-
|**trim**|`trim(self) -> String`| Returns a new string with leading and trailing whitespace removed. |
100
-
|**replace**|`replace(self, target: char*, replacement: char*) -> String`| Returns a new string with all occurrences of `target` replaced by `replacement`. |
101
-
|**pad_left**|`pad_left(self, target_len: usize, pad_char: char) -> String`| Returns a new string padded to `target_len`on the left with `pad_char`. |
102
-
|**pad_right**|`pad_right(self, target_len: usize, pad_char: char) -> String`| Returns a new string padded to `target_len`on the right with `pad_char`. |
97
+
|**split**|`split(self, delim: char) -> Vec<String>`| Splits the string into a vector of substrings. |
98
+
|**trim**|`trim(self) -> String`| Returns a new string with leading/trailing whitespace removed. |
99
+
|**replace**|`replace(self, target: char*, replacement: char*) -> String`| Returns a new string with replacements. |
100
+
|**pad_left**|`pad_left(self, target_len: usize, pad_char: char) -> String`| Returns a new string padded on the left. |
101
+
|**pad_right**|`pad_right(self, target_len: usize, pad_char: char) -> String`| Returns a new string padded on the right. |
103
102
104
103
### Comparison
105
104
106
105
| Method | Signature | Description |
107
106
| :--- | :--- | :--- |
108
-
|**eq**|`eq(self, other: String*) -> bool`| Returns true if the strings are equal content-wise. |
109
-
|**neq**|`neq(self, other: String*) -> bool`| Returns true if the strings are NOT equal content-wise. |
110
-
|**compare**|`compare(self, other: String*) -> int`| Returns < 0 if self < other, 0 if equal, > 0 if self > other (lexical). |
111
-
|**compare_ignore_case**|`compare_ignore_case(self, other: String*) -> int`| Lexical comparison ignoring case (A == a). |
112
-
|**eq_ignore_case**|`eq_ignore_case(self, other: String*) -> bool`| Returns true if strings are equal ignoring case. |
0 commit comments