snowflake.snowpark.functions.unicode

snowflake.snowpark.functions.unicode(input_str: Union[snowflake.snowpark.column.Column, str]) Column[source]

Returns the Unicode code point of the first character in a string.

Parameters:

input_str (ColumnOrName) – The input string column or string value to get the Unicode code point from.

Returns:

The Unicode code point of the first character. Returns 0 for empty strings.

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import col
>>> df = session.create_dataframe([['a'], ['❄'], ['cde'], ['']], schema=["input_str"])
>>> df.select(unicode(col("input_str")).alias("unicode_result")).collect()
[Row(UNICODE_RESULT=97), Row(UNICODE_RESULT=10052), Row(UNICODE_RESULT=99), Row(UNICODE_RESULT=0)]
Copy