snowflake.snowpark.functions.instr¶
- snowflake.snowpark.functions.instr(str: Union[Column, str], substr: str)[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.29.0/snowpark-python/src/snowflake/snowpark/functions.py#L11467-L11479)¶
Locate the position of the first occurrence of substr column in the given string. Returns null if either of the arguments are null.
- Example::
>>> df = session.create_dataframe([["hello world"], ["world hello"]], schema=["text"]) >>> df.select(instr(col("text"), "world").alias("position")).collect() [Row(POSITION=7), Row(POSITION=1)]