This is a quick method about extracting only letters from a string. It is part of the Week2 “Preppin’ data” challenge.
Task for extracting letters from a string
Image you have a string like so: “10.ROADBIKES.423/01” and would like to extract only “ROADBIKES”.
Power Query actually has a function for this purpose: Text.Select. It takes 2 parameters:
- The text to select from
- A list of characters that shall be selected
For the given example the code would look like so:
Text.Select( "10.ROADBIKES.423/01", {"A".."Z"})
This function is always case sensitive as there is no optional parameter that accepts a comparer function.