(ctx: Context)
| 9 | use crate::string::InternedString; |
| 10 | |
| 11 | pub(crate) fn define_string_methods(ctx: Context) -> HashMap<InternedString, BuiltinMethod> { |
| 12 | [ |
| 13 | ("is_empty", BuiltinMethod(is_empty)), |
| 14 | // Case conversion |
| 15 | ("to_uppercase", BuiltinMethod(to_uppercase)), |
| 16 | ("to_lowercase", BuiltinMethod(to_lowercase)), |
| 17 | // Trim functions |
| 18 | ("trim", BuiltinMethod(trim)), |
| 19 | ("trim_start", BuiltinMethod(trim_start)), |
| 20 | ("trim_end", BuiltinMethod(trim_end)), |
| 21 | // Contains and position |
| 22 | ("contains", BuiltinMethod(contains)), |
| 23 | ("starts_with", BuiltinMethod(starts_with)), |
| 24 | ("ends_with", BuiltinMethod(ends_with)), |
| 25 | ("index_of", BuiltinMethod(index_of)), |
| 26 | ("last_index_of", BuiltinMethod(last_index_of)), |
| 27 | // Substring and slicing |
| 28 | ("substring", BuiltinMethod(substring)), |
| 29 | ("slice", BuiltinMethod(slice)), |
| 30 | // Split and join |
| 31 | ("split", BuiltinMethod(split)), |
| 32 | ("join", BuiltinMethod(join)), |
| 33 | // Regex operations |
| 34 | ("regex_match", BuiltinMethod(regex_match)), |
| 35 | ("regex_replace", BuiltinMethod(regex_replace)), |
| 36 | // Misc string operations |
| 37 | ("repeat", BuiltinMethod(repeat)), |
| 38 | ("reverse", BuiltinMethod(reverse)), |
| 39 | ("replace", BuiltinMethod(replace)), |
| 40 | ] |
| 41 | .into_iter() |
| 42 | .map(|(name, f)| (ctx.intern_static(name), f)) |
| 43 | .collect() |
| 44 | } |
| 45 | |
| 46 | fn is_empty<'gc>( |
| 47 | _mc: &'gc Mutation<'gc>, |
no test coverage detected