daft.functions.ascii_func#
ascii_func #
ascii_func(expr: Expression) -> Expression
Returns the ASCII numeric value of the first character of the string.
Returns 0 for empty strings. This is compatible with Spark's ascii function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expr | Expression | The string expression | required |
Returns:
| Name | Type | Description |
|---|---|---|
Expression | Expression | an Int32 expression with the ASCII value |
Examples:
1 2 3 4 5 | |
╭───────╮
│ x │
│ --- │
│ Int32 │
╞═══════╡
│ 65 │
├╌╌╌╌╌╌╌┤
│ 97 │
├╌╌╌╌╌╌╌┤
│ 0 │
╰───────╯
(Showing first 3 of 3 rows) Source code in daft/functions/str.py
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | |