Struct polars_plan::dsl::string::StringNameSpace
source · pub struct StringNameSpace(/* private fields */);
strings
only.Expand description
Specialized expressions for Series
of DataType::String
.
Implementations§
source§impl StringNameSpace
impl StringNameSpace
sourcepub fn contains_literal(self, pat: Expr) -> Expr
Available on crate feature regex
only.
pub fn contains_literal(self, pat: Expr) -> Expr
regex
only.Check if a string value contains a literal substring.
sourcepub fn contains(self, pat: Expr, strict: bool) -> Expr
Available on crate feature regex
only.
pub fn contains(self, pat: Expr, strict: bool) -> Expr
regex
only.Check if this column of strings contains a Regex. If strict
is true
, then it is an error if any pat
is
an invalid regex, whereas if strict
is false
, an invalid regex will simply evaluate to false
.
sourcepub fn contains_any(self, patterns: Expr, ascii_case_insensitive: bool) -> Expr
Available on crate feature find_many
only.
pub fn contains_any(self, patterns: Expr, ascii_case_insensitive: bool) -> Expr
find_many
only.Uses aho-corasick to find many patterns.
§Arguments
patterns
: an expression that evaluates to an String columnascii_case_insensitive
: Enable ASCII-aware case insensitive matching. When this option is enabled, searching will be performed without respect to case for ASCII letters (a-z and A-Z) only.
sourcepub fn replace_many(
self,
patterns: Expr,
replace_with: Expr,
ascii_case_insensitive: bool
) -> Expr
Available on crate feature find_many
only.
pub fn replace_many( self, patterns: Expr, replace_with: Expr, ascii_case_insensitive: bool ) -> Expr
find_many
only.Uses aho-corasick to replace many patterns.
§Arguments
patterns
: an expression that evaluates to an String columnreplace_with
: an expression that evaluates to an String columnascii_case_insensitive
: Enable ASCII-aware case insensitive matching. When this option is enabled, searching will be performed without respect to case for ASCII letters (a-z and A-Z) only.
sourcepub fn starts_with(self, sub: Expr) -> Expr
pub fn starts_with(self, sub: Expr) -> Expr
Check if a string value starts with the sub
string.
pub fn hex_encode(self) -> Expr
string_encoding
only.pub fn hex_decode(self, strict: bool) -> Expr
binary_encoding
only.pub fn base64_encode(self) -> Expr
string_encoding
only.pub fn base64_decode(self, strict: bool) -> Expr
binary_encoding
only.sourcepub fn extract(self, pat: Expr, group_index: usize) -> Expr
pub fn extract(self, pat: Expr, group_index: usize) -> Expr
Extract a regex pattern from the a string value. If group_index
is out of bounds, null is returned.
pub fn extract_groups(self, pat: &str) -> PolarsResult<Expr>
extract_groups
only.sourcepub fn pad_start(self, length: usize, fill_char: char) -> Expr
Available on crate feature string_pad
only.
pub fn pad_start(self, length: usize, fill_char: char) -> Expr
string_pad
only.Pad the start of the string until it reaches the given length.
Padding is done using the specified fill_char
.
Strings with length equal to or greater than the given length are
returned as-is.
sourcepub fn pad_end(self, length: usize, fill_char: char) -> Expr
Available on crate feature string_pad
only.
pub fn pad_end(self, length: usize, fill_char: char) -> Expr
string_pad
only.Pad the end of the string until it reaches the given length.
Padding is done using the specified fill_char
.
Strings with length equal to or greater than the given length are
returned as-is.
sourcepub fn zfill(self, length: Expr) -> Expr
Available on crate feature string_pad
only.
pub fn zfill(self, length: Expr) -> Expr
string_pad
only.Pad the start of the string with zeros until it reaches the given length.
A sign prefix (-
) is handled by inserting the padding after the sign
character rather than before.
Strings with length equal to or greater than the given length are
returned as-is.
sourcepub fn find_literal(self, pat: Expr) -> Expr
Available on crate feature regex
only.
pub fn find_literal(self, pat: Expr) -> Expr
regex
only.Find the index of a literal substring within another string value.
sourcepub fn find(self, pat: Expr, strict: bool) -> Expr
Available on crate feature regex
only.
pub fn find(self, pat: Expr, strict: bool) -> Expr
regex
only.Find the index of a substring defined by a regular expressons within another string value.
sourcepub fn extract_all(self, pat: Expr) -> Expr
pub fn extract_all(self, pat: Expr) -> Expr
Extract each successive non-overlapping match in an individual string as an array
sourcepub fn count_matches(self, pat: Expr, literal: bool) -> Expr
pub fn count_matches(self, pat: Expr, literal: bool) -> Expr
Count all successive non-overlapping regex matches.
sourcepub fn strptime(
self,
dtype: DataType,
options: StrptimeOptions,
ambiguous: Expr
) -> Expr
Available on crate feature temporal
only.
pub fn strptime( self, dtype: DataType, options: StrptimeOptions, ambiguous: Expr ) -> Expr
temporal
only.Convert a String column into a Date/Datetime/Time column.
sourcepub fn to_date(self, options: StrptimeOptions) -> Expr
Available on crate feature dtype-date
only.
pub fn to_date(self, options: StrptimeOptions) -> Expr
dtype-date
only.Convert a String column into a Date column.
sourcepub fn to_datetime(
self,
time_unit: Option<TimeUnit>,
time_zone: Option<TimeZone>,
options: StrptimeOptions,
ambiguous: Expr
) -> Expr
Available on crate feature dtype-datetime
only.
pub fn to_datetime( self, time_unit: Option<TimeUnit>, time_zone: Option<TimeZone>, options: StrptimeOptions, ambiguous: Expr ) -> Expr
dtype-datetime
only.Convert a String column into a Datetime column.
sourcepub fn to_time(self, options: StrptimeOptions) -> Expr
Available on crate feature dtype-time
only.
pub fn to_time(self, options: StrptimeOptions) -> Expr
dtype-time
only.Convert a String column into a Time column.
sourcepub fn to_decimal(self, infer_length: usize) -> Expr
Available on crate feature dtype-decimal
only.
pub fn to_decimal(self, infer_length: usize) -> Expr
dtype-decimal
only.Convert a String column into a Decimal column.
sourcepub fn concat(self, delimiter: &str, ignore_nulls: bool) -> Expr
Available on crate feature concat_str
only.
pub fn concat(self, delimiter: &str, ignore_nulls: bool) -> Expr
concat_str
only.Concat the values into a string array.
§Arguments
delimiter
- A string that will act as delimiter between values.
sourcepub fn split(self, by: Expr) -> Expr
pub fn split(self, by: Expr) -> Expr
Split the string by a substring. The resulting dtype is List<String>
.
sourcepub fn split_inclusive(self, by: Expr) -> Expr
pub fn split_inclusive(self, by: Expr) -> Expr
Split the string by a substring and keep the substring. The resulting dtype is List<String>
.
sourcepub fn split_exact(self, by: Expr, n: usize) -> Expr
Available on crate feature dtype-struct
only.
pub fn split_exact(self, by: Expr, n: usize) -> Expr
dtype-struct
only.Split exactly n
times by a given substring. The resulting dtype is DataType::Struct
.
sourcepub fn split_exact_inclusive(self, by: Expr, n: usize) -> Expr
Available on crate feature dtype-struct
only.
pub fn split_exact_inclusive(self, by: Expr, n: usize) -> Expr
dtype-struct
only.Split exactly n
times by a given substring and keep the substring.
The resulting dtype is DataType::Struct
.
sourcepub fn splitn(self, by: Expr, n: usize) -> Expr
Available on crate feature dtype-struct
only.
pub fn splitn(self, by: Expr, n: usize) -> Expr
dtype-struct
only.Split by a given substring, returning exactly n
items. If there are more possible splits,
keeps the remainder of the string intact. The resulting dtype is DataType::Struct
.
sourcepub fn replace(self, pat: Expr, value: Expr, literal: bool) -> Expr
Available on crate feature regex
only.
pub fn replace(self, pat: Expr, value: Expr, literal: bool) -> Expr
regex
only.Replace values that match a regex pat
with a value
.
sourcepub fn replace_n(self, pat: Expr, value: Expr, literal: bool, n: i64) -> Expr
Available on crate feature regex
only.
pub fn replace_n(self, pat: Expr, value: Expr, literal: bool, n: i64) -> Expr
regex
only.Replace values that match a regex pat
with a value
.
sourcepub fn replace_all(self, pat: Expr, value: Expr, literal: bool) -> Expr
Available on crate feature regex
only.
pub fn replace_all(self, pat: Expr, value: Expr, literal: bool) -> Expr
regex
only.Replace all values that match a regex pat
with a value
.
sourcepub fn reverse(self) -> Expr
Available on crate feature string_reverse
only.
pub fn reverse(self) -> Expr
string_reverse
only.Reverse each string
sourcepub fn strip_chars(self, matches: Expr) -> Expr
pub fn strip_chars(self, matches: Expr) -> Expr
Remove leading and trailing characters, or whitespace if matches is None.
sourcepub fn strip_chars_start(self, matches: Expr) -> Expr
pub fn strip_chars_start(self, matches: Expr) -> Expr
Remove leading characters, or whitespace if matches is None.
sourcepub fn strip_chars_end(self, matches: Expr) -> Expr
pub fn strip_chars_end(self, matches: Expr) -> Expr
Remove trailing characters, or whitespace if matches is None.
sourcepub fn strip_prefix(self, prefix: Expr) -> Expr
pub fn strip_prefix(self, prefix: Expr) -> Expr
Remove prefix.
sourcepub fn strip_suffix(self, suffix: Expr) -> Expr
pub fn strip_suffix(self, suffix: Expr) -> Expr
Remove suffix.
sourcepub fn to_lowercase(self) -> Expr
pub fn to_lowercase(self) -> Expr
Convert all characters to lowercase.
sourcepub fn to_uppercase(self) -> Expr
pub fn to_uppercase(self) -> Expr
Convert all characters to uppercase.
sourcepub fn to_titlecase(self) -> Expr
Available on crate feature nightly
only.
pub fn to_titlecase(self) -> Expr
nightly
only.Convert all characters to titlecase.
sourcepub fn to_integer(self, base: u32, strict: bool) -> Expr
Available on crate feature string_to_integer
only.
pub fn to_integer(self, base: u32, strict: bool) -> Expr
string_to_integer
only.Parse string in base radix into decimal.