-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
new-bigfunctionSuggest a New BigFunctionSuggest a New BigFunction
Description
Check the idea has not already been suggested
- I could not find my idea in existing issues
Edit the title above with self-explanatory function name and argument names
- The function name and the argument names I entered in the title above seems self explanatory to me.
BigFunction Description as it would appear in the documentation
Converts a 2-letter ISO country code to a flag emoji
Examples of (arguments, expected output) as they would appear in the documentation
type: function_sql
author: "Rasmus Engelbrecht Sommer"
description: |-
Converts a 2-letter ISO country code to a flag emoji
arguments:
- name: country_code
type: string
output:
name: country_code_to_flag
type: string
examples:
- description: "with US country code"
arguments:
- "US"
output: "🇺🇸"
- description: "with DK country code"
arguments:
- "DK"
output: "🇩🇰"
- description: "with DE country code"
arguments:
- "DE"
output: "🇩🇪"
- description: "with lowercase country code"
arguments:
- "fr"
output: "🇫🇷"
- description: "with NULL input"
arguments:
- null
output: null
- description: "with empty string"
arguments:
- ""
output: null
- description: "with single character"
arguments:
- "A"
output: null
code: |
CASE
WHEN country_code IS NULL OR LENGTH(TRIM(country_code)) != 2 THEN NULL
ELSE CONCAT(
CHR(127397 + TO_CODE_POINTS(SUBSTR(UPPER(TRIM(country_code)), 1, 1))[OFFSET(0)]),
CHR(127397 + TO_CODE_POINTS(SUBSTR(UPPER(TRIM(country_code)), 2, 1))[OFFSET(0)])
)
END
Metadata
Metadata
Assignees
Labels
new-bigfunctionSuggest a New BigFunctionSuggest a New BigFunction