is there a way to normalize strings in BigQuery?
My dataset looks like:
Alfa Beta
Alfa BETA
alfa beta //with a space after 'beta'
By now I can use lower or upper to normalize the letters but I don't know how to eliminate spaces before and after the text. Does BigQuery have a function like 'TRIM' in Excel?
BigQuery does have LTRIM
(trims spaces from left) and RTRIM
(trims spaces from right) functions. (Strings functions documentation at https://cloud.google.com/bigquery/query-reference#stringfunctions missed them, we will fix this shortly).
Yes. BigQuery has support for TRIM
to remove both leading and trailing spaces.
https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#trim
You can also use LTRIM
for spaces on the left and RTRIM
for spaces on the right.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With