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 {
|
||||
Ok(Value::Ident(String::new(), quotes.normalize()))
|
||||
} else {
|
||||
let s = string[start - 1..end].to_string();
|
||||
match quotes {
|
||||
QuoteKind::Double | QuoteKind::Single => Ok(Value::Ident(s, QuoteKind::Double)),
|
||||
QuoteKind::None => Ok(Value::Ident(s, QuoteKind::None)),
|
||||
}
|
||||
Ok(Value::Ident(string.chars().skip(start - 1).take(end - start + 1).collect(), quotes.normalize()))
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user