String#

The following methods are available under the expr.str attribute.

Expr.str.concat([delimiter, ignore_nulls])

Vertically concatenate the string values in the column to a single string value.

Expr.str.contains(pattern, *[, literal, strict])

Check if string contains a substring that matches a pattern.

Expr.str.contains_any(patterns, *[, ...])

Use the aho-corasick algorithm to find matches.

Expr.str.count_match(pattern)

Count all successive non-overlapping regex matches.

Expr.str.count_matches(pattern, *[, literal])

Count all successive non-overlapping regex matches.

Expr.str.decode(encoding, *[, strict])

Decode values using the provided encoding.

Expr.str.encode(encoding)

Encode values using the provided encoding.

Expr.str.ends_with(suffix)

Check if string values end with a substring.

Expr.str.explode()

Returns a column with a separate row for every string character.

Expr.str.extract(pattern[, group_index])

Extract the target capture group from provided patterns.

Expr.str.extract_all(pattern)

Extract all matches for the given regex pattern.

Expr.str.extract_groups(pattern)

Extract all capture groups for the given regex pattern.

Expr.str.find(pattern, *[, literal, strict])

Return the index position of the first substring matching a pattern.

Expr.str.json_decode([dtype, ...])

Parse string values as JSON.

Expr.str.json_extract([dtype, ...])

Parse string values as JSON.

Expr.str.json_path_match(json_path)

Extract the first match of JSON string with the provided JSONPath expression.

Expr.str.len_bytes()

Return the length of each string as the number of bytes.

Expr.str.len_chars()

Return the length of each string as the number of characters.

Expr.str.lengths()

Return the length of each string as the number of bytes.

Expr.str.ljust(length[, fill_char])

Return the string left justified in a string of length length.

Expr.str.lstrip([characters])

Remove leading characters.

Expr.str.n_chars()

Return the length of each string as the number of characters.

Expr.str.pad_end(length[, fill_char])

Pad the end of the string until it reaches the given length.

Expr.str.pad_start(length[, fill_char])

Pad the start of the string until it reaches the given length.

Expr.str.replace(pattern, value, *[, literal, n])

Replace first matching regex/literal substring with a new string value.

Expr.str.replace_all(pattern, value, *[, ...])

Replace all matching regex/literal substrings with a new string value.

Expr.str.replace_many(patterns, replace_with, *)

Use the aho-corasick algorithm to replace many matches.

Expr.str.reverse()

Returns string values in reversed order.

Expr.str.rjust(length[, fill_char])

Return the string right justified in a string of length length.

Expr.str.rstrip([characters])

Remove trailing characters.

Expr.str.slice(offset[, length])

Extract a substring from each string value.

Expr.str.split(by, *[, inclusive])

Split the string by a substring.

Expr.str.split_exact(by, n, *[, inclusive])

Split the string by a substring using n splits.

Expr.str.splitn(by, n)

Split the string by a substring, restricted to returning at most n items.

Expr.str.starts_with(prefix)

Check if string values start with a substring.

Expr.str.strip([characters])

Remove leading and trailing characters.

Expr.str.strip_chars([characters])

Remove leading and trailing characters.

Expr.str.strip_chars_start([characters])

Remove leading characters.

Expr.str.strip_chars_end([characters])

Remove trailing characters.

Expr.str.strip_prefix(prefix)

Remove prefix.

Expr.str.strip_suffix(suffix)

Remove suffix.

Expr.str.strptime(dtype[, format, strict, ...])

Convert a String column into a Date/Datetime/Time column.

Expr.str.to_date([format, strict, exact, cache])

Convert a String column into a Date column.

Expr.str.to_datetime([format, time_unit, ...])

Convert a String column into a Datetime column.

Expr.str.to_decimal([inference_length])

Convert a String column into a Decimal column.

Expr.str.to_integer(*[, base, strict])

Convert a String column into an Int64 column with base radix.

Expr.str.to_lowercase()

Transform to lowercase variant.

Expr.str.to_titlecase()

Transform to titlecase variant.

Expr.str.to_time([format, strict, cache])

Convert a String column into a Time column.

Expr.str.to_uppercase()

Transform to uppercase variant.

Expr.str.zfill(length)

Pad the start of the string with zeros until it reaches the given length.

Expr.str.parse_int([base, strict])

Parse integers with base radix from strings.