mirror of
https://github.com/nushell/nushell.git
synced 2025-08-13 09:27:55 +02:00
Fix 907 and improve substring
This commit is contained in:
@ -41,9 +41,13 @@ impl Str {
|
||||
if start > input.len() - 1 {
|
||||
Value::string("")
|
||||
} else {
|
||||
// Index operator isn't perfect:
|
||||
// https://users.rust-lang.org/t/how-to-get-a-substring-of-a-string/1351
|
||||
Value::string(&input[start..end])
|
||||
Value::string(
|
||||
&input
|
||||
.chars()
|
||||
.skip(start)
|
||||
.take(end - start)
|
||||
.collect::<String>(),
|
||||
)
|
||||
}
|
||||
}
|
||||
Some(Action::ToInteger) => match input.trim() {
|
||||
|
Reference in New Issue
Block a user