str-slice by chars rather than bytes
This commit is contained in:
parent
dc0d7c4e89
commit
2705d79d1a
@ -114,11 +114,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
|||||||
if start > end || start > str_len {
|
if start > end || start > str_len {
|
||||||
Ok(Value::Ident(String::new(), quotes.normalize()))
|
Ok(Value::Ident(String::new(), quotes.normalize()))
|
||||||
} else {
|
} else {
|
||||||
let s = string[start - 1..end].to_string();
|
Ok(Value::Ident(string.chars().skip(start - 1).take(end - start + 1).collect(), quotes.normalize()))
|
||||||
match quotes {
|
|
||||||
QuoteKind::Double | QuoteKind::Single => Ok(Value::Ident(s, QuoteKind::Double)),
|
|
||||||
QuoteKind::None => Ok(Value::Ident(s, QuoteKind::None)),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user