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

snowflake.snowpark.functions.initcap¶

snowflake.snowpark.functions.initcap(e: Union[Column, str], delimiters: Optional[Union[Column, str]] = None) → Column[source]¶

Returns the input string with the first letter of each word in uppercase and the subsequent letters in lowercase.

delimiters is an optional argument specifying a string of one or more characters that initcap uses as separators for words in the input expression.

If delimiters is not specified, any of the following characters in the input expressions are treated as word separators:

<whitespace> ! ? @ " ^ # $ & ~ _ , . : ; + - * % / | \ [ ] ( ) { } < >

Examples:

>>> df = session.create_dataframe(["the sky is blue", "WE CAN HANDLE THIS", "ÄäÖößÜü", None], schema=["a"])
>>> df.select(initcap(df["a"]).alias("initcap")).collect()
[Row(INITCAP='The Sky Is Blue'), Row(INITCAP='We Can Handle This'), Row(INITCAP='Ääöößüü'), Row(INITCAP=None)]
>>> df.select(initcap(df["a"], lit('')).alias("initcap")).collect()
[Row(INITCAP='The sky is blue'), Row(INITCAP='We can handle this'), Row(INITCAP='Ääöößüü'), Row(INITCAP=None)]
Copy