v.24.12New Feature
Function translate supports character deletion for mismatched argument lengths
Functiontranslatenow supports character deletion if thefromargument contains more characters than thetoargument. Example:SELECT translate('clickhouse', 'clickhouse', 'CLICK')now returnsCLICK. #71441 (shuai.xu).
Why it matters
This enhancement allows users to remove specific characters from strings by mapping them to nothing, providing more flexible string manipulation capabilities within ClickHouse queries.How to use it
Use thetranslate function with a from string longer than the to string. Characters in from that lack corresponding characters in to will be deleted. For example:SELECT translate('clickhouse', 'clickhouse', 'CLICK')returns:
CLICK