You are viewing documentation about an older version (1.3.0). View latest version

snowflake.snowpark.functions.ascii¶

snowflake.snowpark.functions.ascii(e: ColumnOrName) → Column[source]¶

Returns the ASCII code for the first character of a string. If the string is empty, a value of 0 is returned.

Example:

>>> df = session.create_dataframe(['!', 'A', 'a', '', 'bcd', None], schema=['a'])
>>> df.select(df.a, ascii(df.a).as_('ascii')).collect()
[Row(A='!', ASCII=33), Row(A='A', ASCII=65), Row(A='a', ASCII=97), Row(A='', ASCII=0), Row(A='bcd', ASCII=98), Row(A=None, ASCII=None)]
Copy