mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 23:49:44 +01:00
remove the hard coded escaping from split row and split column (#4731)
This commit is contained in:
parent
02dfb57ed1
commit
5b3cc73ac6
@ -114,12 +114,10 @@ fn split_column_helper(
|
||||
head: Span,
|
||||
) -> Vec<Value> {
|
||||
if let Ok(s) = v.as_string() {
|
||||
let splitter = separator.item.replace("\\n", "\n");
|
||||
|
||||
let split_result: Vec<_> = if collapse_empty {
|
||||
s.split(&splitter).filter(|s| !s.is_empty()).collect()
|
||||
s.split(&separator.item).filter(|s| !s.is_empty()).collect()
|
||||
} else {
|
||||
s.split(&splitter).collect()
|
||||
s.split(&separator.item).collect()
|
||||
};
|
||||
|
||||
let positional: Vec<_> = rest.iter().map(|f| f.item.clone()).collect();
|
||||
|
@ -86,8 +86,7 @@ fn split_row_helper(v: &Value, separator: &Spanned<String>, name: Span) -> Vec<V
|
||||
match v.span() {
|
||||
Ok(v_span) => {
|
||||
if let Ok(s) = v.as_string() {
|
||||
let splitter = separator.item.replace("\\n", "\n");
|
||||
s.split(&splitter)
|
||||
s.split(&separator.item)
|
||||
.filter_map(|s| {
|
||||
if s.trim() != "" {
|
||||
Some(Value::string(s, v_span))
|
||||
|
Loading…
Reference in New Issue
Block a user