Skip to content

Commit 1f97836

Browse files
committed
screenshot
1 parent 9254e74 commit 1f97836

2 files changed

+6
-11
lines changed

forumQuestions/pq/2024-10 - Auto trim column names for whitespace -- InspectWhitespace and FormatShowControlSymbosl.pq

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ let
1010
InspectInvisibleText = ( columnNames as list ) =>
1111
let return =
1212
List.Transform( columnNames, ( curName ) => [
13-
HasWhitespace = RawName <> Text.Trim( curName ),
13+
HasOuterWhitespace = RawName <> Text.Trim( Text.Clean( curName ) ),
1414
RawName = curName,
15+
1516
Symbols = Text.FormatControlSymbols( curName ),
16-
HexSummary = "Hex: " & Text.Combine( AsHexStr, ", " ),
17+
HexSummary = "Hex: " & Text.Combine( AsHexStr, ", " ),
1718
DecSummary = "Dec: " & Text.Combine( List.Transform( Codepoints, each Text.From(_)), ", " ),
1819

1920
CharList = Text.ToList( RawName ),
@@ -34,19 +35,13 @@ let
3435
is 0-127 in decimal
3536
or 0x0-0x7f in hexadecimal
3637
*/
38+
3739
/*
38-
input: text with whitespace
39-
output: text with whitespace, visualized. Non-whitespace characters are preserved.
40+
input: text with whitespace
41+
output: text with whitespace visualized
4042
Techincally this isn't codepoints, so it's not perfect, but works for all of ascii
4143

4244
probably poor performance
43-
44-
example:
45-
in: " User#(cr,lf) Names"
46-
out: "␠␠User␍␊␠Names"
47-
48-
in: "#(0020) Zero-Width #(200d) Joiner Inside",
49-
out: "␠␠Zero-Width␠<ZWJ>␠Joiner␠Inside"
5045
*/
5146
Text.FormatControlSymbols = (string as text) as text =>
5247
let

0 commit comments

Comments
 (0)