Struct StringNameSpace
pub struct StringNameSpace(/* private fields */);
Expand description
Specialized expressions for Series
of DataType::String
.
Implementations§
§impl StringNameSpace
impl StringNameSpace
pub fn contains_literal(self, pat: Expr) -> Expr
pub fn contains_literal(self, pat: Expr) -> Expr
Check if a string value contains a literal substring.
pub fn contains(self, pat: Expr, strict: bool) -> Expr
pub fn contains(self, pat: Expr, strict: bool) -> Expr
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
.
pub 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
pub fn hex_decode(self, strict: bool) -> Expr
pub fn base64_encode(self) -> Expr
pub fn base64_decode(self, strict: bool) -> Expr
pub 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) -> Result<Expr, PolarsError>
pub fn pad_start(self, length: usize, fill_char: char) -> Expr
pub fn pad_start(self, length: usize, fill_char: char) -> Expr
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.
pub fn pad_end(self, length: usize, fill_char: char) -> Expr
pub fn pad_end(self, length: usize, fill_char: char) -> Expr
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.
pub fn zfill(self, length: Expr) -> Expr
pub fn zfill(self, length: Expr) -> Expr
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.
pub fn find_literal(self, pat: Expr) -> Expr
pub fn find_literal(self, pat: Expr) -> Expr
Find the index of a literal substring within another string value.
pub fn find(self, pat: Expr, strict: bool) -> Expr
pub fn find(self, pat: Expr, strict: bool) -> Expr
Find the index of a substring defined by a regular expressions within another string value.
pub 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
pub 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.
pub fn strptime(
self,
dtype: DataType,
options: StrptimeOptions,
ambiguous: Expr,
) -> Expr
pub fn strptime( self, dtype: DataType, options: StrptimeOptions, ambiguous: Expr, ) -> Expr
Convert a String column into a Date/Datetime/Time column.
pub fn to_date(self, options: StrptimeOptions) -> Expr
pub fn to_date(self, options: StrptimeOptions) -> Expr
Convert a String column into a Date column.
pub fn to_datetime(
self,
time_unit: Option<TimeUnit>,
time_zone: Option<PlSmallStr>,
options: StrptimeOptions,
ambiguous: Expr,
) -> Expr
pub fn to_datetime( self, time_unit: Option<TimeUnit>, time_zone: Option<PlSmallStr>, options: StrptimeOptions, ambiguous: Expr, ) -> Expr
Convert a String column into a Datetime column.
pub fn to_time(self, options: StrptimeOptions) -> Expr
pub fn to_time(self, options: StrptimeOptions) -> Expr
Convert a String column into a Time column.
pub fn to_decimal(self, infer_length: usize) -> Expr
pub fn to_decimal(self, infer_length: usize) -> Expr
Convert a String column into a Decimal column.
pub fn join(self, delimiter: &str, ignore_nulls: bool) -> Expr
pub fn join(self, delimiter: &str, ignore_nulls: bool) -> Expr
Concat the values into a string array.
§Arguments
delimiter
- A string that will act as delimiter between values.
pub 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>
.
pub 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>
.
pub fn split_exact(self, by: Expr, n: usize) -> Expr
pub fn split_exact(self, by: Expr, n: usize) -> Expr
Split exactly n
times by a given substring. The resulting dtype is DataType::Struct
.
pub fn split_exact_inclusive(self, by: Expr, n: usize) -> Expr
pub fn split_exact_inclusive(self, by: Expr, n: usize) -> Expr
Split exactly n
times by a given substring and keep the substring.
The resulting dtype is DataType::Struct
.
pub fn splitn(self, by: Expr, n: usize) -> Expr
pub fn splitn(self, by: Expr, n: usize) -> Expr
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
.
pub fn replace(self, pat: Expr, value: Expr, literal: bool) -> Expr
pub fn replace(self, pat: Expr, value: Expr, literal: bool) -> Expr
Replace values that match a regex pat
with a value
.
pub fn replace_n(self, pat: Expr, value: Expr, literal: bool, n: i64) -> Expr
pub fn replace_n(self, pat: Expr, value: Expr, literal: bool, n: i64) -> Expr
Replace values that match a regex pat
with a value
.
pub fn replace_all(self, pat: Expr, value: Expr, literal: bool) -> Expr
pub fn replace_all(self, pat: Expr, value: Expr, literal: bool) -> Expr
Replace all values that match a regex pat
with a value
.
pub fn normalize(self, form: UnicodeForm) -> Expr
pub fn normalize(self, form: UnicodeForm) -> Expr
Normalize each string
pub 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.
pub 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.
pub 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.
pub fn strip_prefix(self, prefix: Expr) -> Expr
pub fn strip_prefix(self, prefix: Expr) -> Expr
Remove prefix.
pub fn strip_suffix(self, suffix: Expr) -> Expr
pub fn strip_suffix(self, suffix: Expr) -> Expr
Remove suffix.
pub fn to_lowercase(self) -> Expr
pub fn to_lowercase(self) -> Expr
Convert all characters to lowercase.
pub fn to_uppercase(self) -> Expr
pub fn to_uppercase(self) -> Expr
Convert all characters to uppercase.
pub fn to_titlecase(self) -> Expr
pub fn to_titlecase(self) -> Expr
Convert all characters to titlecase.
pub fn to_integer(self, base: Expr, strict: bool) -> Expr
pub fn to_integer(self, base: Expr, strict: bool) -> Expr
Parse string in base radix into decimal.
pub fn json_decode( self, dtype: Option<DataType>, infer_schema_len: Option<usize>, ) -> Expr
pub fn json_path_match(self, pat: Expr) -> Expr
pub fn escape_regex(self) -> Expr
Auto Trait Implementations§
impl !Freeze for StringNameSpace
impl !RefUnwindSafe for StringNameSpace
impl Send for StringNameSpace
impl Sync for StringNameSpace
impl Unpin for StringNameSpace
impl !UnwindSafe for StringNameSpace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more