polars.internals.series.string.StringNameSpace.starts_with#

StringNameSpace.starts_with(sub: str) Series[source]#

Check if string values start with a substring.

Parameters:
sub

Prefix substring.

See also

contains

Check if string contains a substring that matches a regex.

ends_with

Check if string values end with a substring.

Examples

>>> s = pl.Series("fruits", ["apple", "mango", None])
>>> s.str.starts_with("app")
shape: (3,)
Series: 'fruits' [bool]
[
    true
    false
    null
]