Add split version for chars.
This commit is contained in:
parent
e88713611c
commit
8248c9999d
@ -372,6 +372,10 @@ mod string_functions {
|
|||||||
format!("{:?}{}", array, string)
|
format!("{:?}{}", array, string)
|
||||||
}
|
}
|
||||||
#[rhai_fn(name = "split")]
|
#[rhai_fn(name = "split")]
|
||||||
|
pub fn chars(string: &str) -> Array {
|
||||||
|
string.chars().map(Into::<Dynamic>::into).collect()
|
||||||
|
}
|
||||||
|
#[rhai_fn(name = "split")]
|
||||||
pub fn split_at(string: ImmutableString, start: INT) -> Array {
|
pub fn split_at(string: ImmutableString, start: INT) -> Array {
|
||||||
if start <= 0 {
|
if start <= 0 {
|
||||||
vec!["".into(), string.into()]
|
vec!["".into(), string.into()]
|
||||||
|
Loading…
Reference in New Issue
Block a user