Forum Discussion
michellepace
5 years agoResolver III
type Text: Clean in-between white space
Hi. Is there a way to parse text to single white spaces only? That is: "mary white helloooo" Becomes: "mary white helloooo"
- Anonymous5 years ago
try this
let Source = Excel.Workbook(File.Contents("C:yourpath\Q.14 Data.xlsx"), null, true), Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data], #"Changed Type" = Table.TransformColumnTypes(Table1_Table,{{"Single space everything, and trim both ends (don’t make a new column)", type text}}), tc=Table.TransformColumns( #"Changed Type", {"Single space everything, and trim both ends (don’t make a new column)", each Text.Combine(List.Select(Text.Split(_," "), each _<>""), " ")}) in tc
ziying35
5 years agoImpactful Individual
Hi, michellepace
Try this:
= let str="mary white helloooo" in Text.Combine(Splitter.SplitTextByWhitespace()(str), " ")If my code solves your problem, mark it as a solution
Anonymous
5 years agoNot applicable
= Splitter.SplitTextByWhitespace()(" mary white helloooo ")
this function, that of which I now know the existence thanks to ziying35 , for a string with leading or trailing whites spaces, gives this result
where the first and last element are the empty string "".
Why?
what kind of internal logic is applied in your opinion?