Forum Discussion
Error with Text.Trim
Right, so the list needs to hold single text values. It has lots of multi-character values
- DemoFour3 years agoContinued Contributor
Can you eloborate a bit please.
The list of Punctuatuation is below. I added the .. ... !! !!! !!!! becasue of the source tweet text containing this to try and fix the issue.
The list= {" ", "~", ",", ".", "..", ". .", "...", "....", ".....", "?", "!", "!!", "!!!", "!!!!", "!!!!!", ", ", (", "), "[", "]", "{", "}", "%", "^", "&", "*", "+", "=", ":", ";", "|", "<", ">", "/", """, """, "\", """", "#(tab)", "#(cr)", "#(lf)"}In the Raviv book, the text is all nice and neet of course, real world data is unpredictable and not following an easy format.
I did not think this would be such an issue, to learn some M and to try out some textual clean up and analysis for an upcoming project.- HotChilli3 years agoCommunity Champion
"...", "!!!!"
are multi-character strings.
"." or "!" are single character
- AlexisOlson3 years agoSuper User
HotChilli is correct. The Text.Trim function only takes a list of single characters.
For example, this does not work
But this does:
If you clean up your list to remove multi-character strings then it should work. For example, try this definition:
{" ", "~", ",", ".", "?", "!", "(", ")", "[", "]", "{", "}", "%", "^", "&", "*", "+", "=", ":", ";", "|", "<", ">", "/", """", "\", "#(tab)", "#(cr)", "#(lf)"}- DemoFour3 years agoContinued Contributor
HotChilli AlexisOlson
Thanks guys, so the previous error I was getting because the column had multiple strings. That makes sense.
Can you suggest a robust way to remove the multi stings, or is it a case of manually using replace text for all combinations - I feel that this is not very scaleable, so may brake the query.
Thanks for taking the time to respond.