polars::prelude::strings

Trait StringNameSpaceImpl

Source
pub trait StringNameSpaceImpl: AsString {
Show 44 methods // Provided methods fn hex_decode(&self) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn hex_encode(&self) -> ChunkedArray<StringType> { ... } fn base64_decode(&self) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn base64_encode(&self) -> ChunkedArray<StringType> { ... } fn to_integer( &self, base: &ChunkedArray<UInt32Type>, strict: bool, ) -> Result<ChunkedArray<Int64Type>, PolarsError> { ... } fn contains_chunked( &self, pat: &ChunkedArray<StringType>, literal: bool, strict: bool, ) -> Result<ChunkedArray<BooleanType>, PolarsError> { ... } fn find_chunked( &self, pat: &ChunkedArray<StringType>, literal: bool, strict: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError> { ... } fn starts_with(&self, sub: &str) -> ChunkedArray<BooleanType> { ... } fn starts_with_chunked( &self, prefix: &ChunkedArray<StringType>, ) -> ChunkedArray<BooleanType> { ... } fn str_len_chars(&self) -> ChunkedArray<UInt32Type> { ... } fn str_len_bytes(&self) -> ChunkedArray<UInt32Type> { ... } fn contains( &self, pat: &str, strict: bool, ) -> Result<ChunkedArray<BooleanType>, PolarsError> { ... } fn contains_literal( &self, lit: &str, ) -> Result<ChunkedArray<BooleanType>, PolarsError> { ... } fn find_literal( &self, lit: &str, ) -> Result<ChunkedArray<UInt32Type>, PolarsError> { ... } fn find( &self, pat: &str, strict: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError> { ... } fn replace<'a>( &'a self, pat: &str, val: &str, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn replace_literal<'a>( &'a self, pat: &str, val: &str, n: usize, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn replace_all( &self, pat: &str, val: &str, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn replace_literal_all<'a>( &'a self, pat: &str, val: &str, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn extract( &self, pat: &ChunkedArray<StringType>, group_index: usize, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn extract_all( &self, pat: &str, ) -> Result<ChunkedArray<ListType>, PolarsError> { ... } fn strip_chars( &self, pat: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn strip_chars_start( &self, pat: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn strip_chars_end( &self, pat: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn strip_prefix( &self, prefix: &ChunkedArray<StringType>, ) -> ChunkedArray<StringType> { ... } fn strip_suffix( &self, suffix: &ChunkedArray<StringType>, ) -> ChunkedArray<StringType> { ... } fn split_exact( &self, by: &ChunkedArray<StringType>, n: usize, ) -> Result<ChunkedArray<StructType>, PolarsError> { ... } fn split_exact_inclusive( &self, by: &ChunkedArray<StringType>, n: usize, ) -> Result<ChunkedArray<StructType>, PolarsError> { ... } fn splitn( &self, by: &ChunkedArray<StringType>, n: usize, ) -> Result<ChunkedArray<StructType>, PolarsError> { ... } fn split(&self, by: &ChunkedArray<StringType>) -> ChunkedArray<ListType> { ... } fn split_inclusive( &self, by: &ChunkedArray<StringType>, ) -> ChunkedArray<ListType> { ... } fn extract_all_many( &self, pat: &ChunkedArray<StringType>, ) -> Result<ChunkedArray<ListType>, PolarsError> { ... } fn extract_groups( &self, pat: &str, dtype: &DataType, ) -> Result<Series, PolarsError> { ... } fn count_matches( &self, pat: &str, literal: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError> { ... } fn count_matches_many( &self, pat: &ChunkedArray<StringType>, literal: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError> { ... } fn to_lowercase(&self) -> ChunkedArray<StringType> { ... } fn to_uppercase(&self) -> ChunkedArray<StringType> { ... } fn to_titlecase(&self) -> ChunkedArray<StringType> { ... } fn concat( &self, other: &ChunkedArray<StringType>, ) -> ChunkedArray<StringType> { ... } fn str_reverse(&self) -> ChunkedArray<StringType> { ... } fn str_slice( &self, offset: &Column, length: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn str_head( &self, n: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn str_tail( &self, n: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError> { ... } fn str_escape_regex(&self) -> ChunkedArray<StringType> { ... }
}
Available on crate feature polars-ops only.

Provided Methods§

Source

fn hex_decode(&self) -> Result<ChunkedArray<StringType>, PolarsError>

Available on non-crate feature binary_encoding only.
Source

fn hex_encode(&self) -> ChunkedArray<StringType>

Available on crate feature string_encoding only.
Source

fn base64_decode(&self) -> Result<ChunkedArray<StringType>, PolarsError>

Available on non-crate feature binary_encoding only.
Source

fn base64_encode(&self) -> ChunkedArray<StringType>

Available on crate feature string_encoding only.
Source

fn to_integer( &self, base: &ChunkedArray<UInt32Type>, strict: bool, ) -> Result<ChunkedArray<Int64Type>, PolarsError>

Available on crate feature string_to_integer only.
Source

fn contains_chunked( &self, pat: &ChunkedArray<StringType>, literal: bool, strict: bool, ) -> Result<ChunkedArray<BooleanType>, PolarsError>

Source

fn find_chunked( &self, pat: &ChunkedArray<StringType>, literal: bool, strict: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError>

Source

fn starts_with(&self, sub: &str) -> ChunkedArray<BooleanType>

Check if strings starts with a substring

Source

fn starts_with_chunked( &self, prefix: &ChunkedArray<StringType>, ) -> ChunkedArray<BooleanType>

This is more performant than the BinaryChunked version because we use the inline prefix Use the BinaryChunked::ends_with as there is no specialization here for that

Source

fn str_len_chars(&self) -> ChunkedArray<UInt32Type>

Get the length of the string values as number of chars.

Source

fn str_len_bytes(&self) -> ChunkedArray<UInt32Type>

Get the length of the string values as number of bytes.

Source

fn contains( &self, pat: &str, strict: bool, ) -> Result<ChunkedArray<BooleanType>, PolarsError>

Check if strings contain a regex pattern.

Source

fn contains_literal( &self, lit: &str, ) -> Result<ChunkedArray<BooleanType>, PolarsError>

Check if strings contain a given literal

Source

fn find_literal( &self, lit: &str, ) -> Result<ChunkedArray<UInt32Type>, PolarsError>

Return the index position of a literal substring in the target string.

Source

fn find( &self, pat: &str, strict: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError>

Return the index position of a regular expression substring in the target string.

Source

fn replace<'a>( &'a self, pat: &str, val: &str, ) -> Result<ChunkedArray<StringType>, PolarsError>

Replace the leftmost regex-matched (sub)string with another string

Source

fn replace_literal<'a>( &'a self, pat: &str, val: &str, n: usize, ) -> Result<ChunkedArray<StringType>, PolarsError>

Replace the leftmost literal (sub)string with another string

Source

fn replace_all( &self, pat: &str, val: &str, ) -> Result<ChunkedArray<StringType>, PolarsError>

Replace all regex-matched (sub)strings with another string

Source

fn replace_literal_all<'a>( &'a self, pat: &str, val: &str, ) -> Result<ChunkedArray<StringType>, PolarsError>

Replace all matching literal (sub)strings with another string

Source

fn extract( &self, pat: &ChunkedArray<StringType>, group_index: usize, ) -> Result<ChunkedArray<StringType>, PolarsError>

Extract the nth capture group from pattern.

Source

fn extract_all(&self, pat: &str) -> Result<ChunkedArray<ListType>, PolarsError>

Extract each successive non-overlapping regex match in an individual string as an array.

Source

fn strip_chars( &self, pat: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError>

Source

fn strip_chars_start( &self, pat: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError>

Source

fn strip_chars_end( &self, pat: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError>

Source

fn strip_prefix( &self, prefix: &ChunkedArray<StringType>, ) -> ChunkedArray<StringType>

Source

fn strip_suffix( &self, suffix: &ChunkedArray<StringType>, ) -> ChunkedArray<StringType>

Source

fn split_exact( &self, by: &ChunkedArray<StringType>, n: usize, ) -> Result<ChunkedArray<StructType>, PolarsError>

Available on crate feature dtype-struct only.
Source

fn split_exact_inclusive( &self, by: &ChunkedArray<StringType>, n: usize, ) -> Result<ChunkedArray<StructType>, PolarsError>

Available on crate feature dtype-struct only.
Source

fn splitn( &self, by: &ChunkedArray<StringType>, n: usize, ) -> Result<ChunkedArray<StructType>, PolarsError>

Available on crate feature dtype-struct only.
Source

fn split(&self, by: &ChunkedArray<StringType>) -> ChunkedArray<ListType>

Source

fn split_inclusive( &self, by: &ChunkedArray<StringType>, ) -> ChunkedArray<ListType>

Source

fn extract_all_many( &self, pat: &ChunkedArray<StringType>, ) -> Result<ChunkedArray<ListType>, PolarsError>

Extract each successive non-overlapping regex match in an individual string as an array.

Source

fn extract_groups( &self, pat: &str, dtype: &DataType, ) -> Result<Series, PolarsError>

Available on crate feature extract_groups only.

Extract all capture groups from pattern and return as a struct.

Source

fn count_matches( &self, pat: &str, literal: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError>

Count all successive non-overlapping regex matches.

Source

fn count_matches_many( &self, pat: &ChunkedArray<StringType>, literal: bool, ) -> Result<ChunkedArray<UInt32Type>, PolarsError>

Count all successive non-overlapping regex matches.

Source

fn to_lowercase(&self) -> ChunkedArray<StringType>

Modify the strings to their lowercase equivalent.

Source

fn to_uppercase(&self) -> ChunkedArray<StringType>

Modify the strings to their uppercase equivalent.

Source

fn to_titlecase(&self) -> ChunkedArray<StringType>

Available on crate feature nightly only.

Modify the strings to their titlecase equivalent.

Source

fn concat(&self, other: &ChunkedArray<StringType>) -> ChunkedArray<StringType>

Concat with the values from a second StringChunked.

Source

fn str_reverse(&self) -> ChunkedArray<StringType>

Available on crate feature string_reverse only.

Reverses the string values

Source

fn str_slice( &self, offset: &Column, length: &Column, ) -> Result<ChunkedArray<StringType>, PolarsError>

Slice the string values.

Determines a substring starting from offset and with length length of each of the elements in array. offset can be negative, in which case the start counts from the end of the string.

Source

fn str_head(&self, n: &Column) -> Result<ChunkedArray<StringType>, PolarsError>

Slice the first n values of the string.

Determines a substring starting at the beginning of the string up to offset n of each element in array. n can be negative, in which case the slice ends n characters from the end of the string.

Source

fn str_tail(&self, n: &Column) -> Result<ChunkedArray<StringType>, PolarsError>

Slice the last n values of the string.

Determines a substring starting at offset n of each element in array. n can be negative, in which case the slice begins n characters from the start of the string.

Source

fn str_escape_regex(&self) -> ChunkedArray<StringType>

Available on crate feature strings only.

Escapes all regular expression meta characters in the string.

Implementors§