Forum Discussion
Anonymous
4 years agoNot applicable
Add trim after Split
I am using this to Find/Replace a table let
Repl = Table.Buffer(ReplacementsTable),
Text = Text,
Result = Table.AddColumn(Text, "Changed Text Expected",
each Text.Combine(
List...
- 4 years ago
Use below in place of Text.Split([Text], "|")
Text.Split(Text.Replace(Text.Replace([Text]," |","|"),"| ","|") "|")
AlexisOlson
4 years agoSuper User
You can replace
Text.Split([Text], "|")
with
List.Transform(Text.Split([Text], "|"), Text.Trim)
to trim each string after separating by "|".
Here's another implementation that uses List.ReplaceMatchingItems:
let
Repl = Table.Buffer(ReplacementsTable),
Text = Text,
Result = Table.AddColumn(
Text,
"Changed Text Expected",
each Text.Combine(
List.ReplaceMatchingItems(
List.Transform(Text.Split([Text], "|"), Text.Trim),
List.Zip({Repl[Word To Replace], Repl[Replace With]})
),
"|"
)
)
in
Result