polars_lazy::dsl::string

Struct StringNameSpace

Source
pub struct StringNameSpace(/* private fields */);
Available on crate feature strings only.
Expand description

Specialized expressions for Series of DataType::String.

Implementations§

Source§

impl StringNameSpace

Source

pub fn contains_literal(self, pat: Expr) -> Expr

Available on crate feature regex only.

Check if a string value contains a literal substring.

Source

pub fn contains(self, pat: Expr, strict: bool) -> Expr

Available on crate feature 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.

Source

pub fn ends_with(self, sub: Expr) -> Expr

Check if a string value ends with the sub string.

Source

pub fn starts_with(self, sub: Expr) -> Expr

Check if a string value starts with the sub string.

Source

pub fn hex_encode(self) -> Expr

Available on crate feature string_encoding only.
Source

pub fn hex_decode(self, strict: bool) -> Expr

Available on crate feature binary_encoding only.
Source

pub fn base64_encode(self) -> Expr

Available on crate feature string_encoding only.
Source

pub fn base64_decode(self, strict: bool) -> Expr

Available on crate feature binary_encoding only.
Source

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.

Source

pub fn extract_groups(self, pat: &str) -> Result<Expr, PolarsError>

Available on crate feature extract_groups only.
Source

pub fn pad_start(self, length: usize, fill_char: char) -> Expr

Available on crate feature 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.

Source

pub fn pad_end(self, length: usize, fill_char: char) -> Expr

Available on crate feature 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.

Source

pub fn zfill(self, length: Expr) -> Expr

Available on crate feature 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.

Source

pub fn find_literal(self, pat: Expr) -> Expr

Available on crate feature regex only.

Find the index of a literal substring within another string value.

Source

pub fn find(self, pat: Expr, strict: bool) -> Expr

Available on crate feature regex only.

Find the index of a substring defined by a regular expressions within another string value.

Source

pub fn extract_all(self, pat: Expr) -> Expr

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

Source

pub fn count_matches(self, pat: Expr, literal: bool) -> Expr

Count all successive non-overlapping regex matches.

Source

pub fn strptime( self, dtype: DataType, options: StrptimeOptions, ambiguous: Expr, ) -> Expr

Available on crate feature temporal only.

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

Source

pub fn to_date(self, options: StrptimeOptions) -> Expr

Available on crate feature dtype-date only.

Convert a String column into a Date column.

Source

pub fn to_datetime( self, time_unit: Option<TimeUnit>, time_zone: Option<PlSmallStr>, options: StrptimeOptions, ambiguous: Expr, ) -> Expr

Available on crate feature dtype-datetime only.

Convert a String column into a Datetime column.

Source

pub fn to_time(self, options: StrptimeOptions) -> Expr

Available on crate feature dtype-time only.

Convert a String column into a Time column.

Source

pub fn to_decimal(self, infer_length: usize) -> Expr

Available on crate feature dtype-decimal only.

Convert a String column into a Decimal column.

Source

pub fn join(self, delimiter: &str, ignore_nulls: bool) -> Expr

Available on crate feature concat_str only.

Concat the values into a string array.

§Arguments
  • delimiter - A string that will act as delimiter between values.
Source

pub fn split(self, by: Expr) -> Expr

Split the string by a substring. The resulting dtype is List<String>.

Source

pub fn split_inclusive(self, by: Expr) -> Expr

Split the string by a substring and keep the substring. The resulting dtype is List<String>.

Source

pub fn split_exact(self, by: Expr, n: usize) -> Expr

Available on crate feature dtype-struct only.

Split exactly n times by a given substring. The resulting dtype is DataType::Struct.

Source

pub fn split_exact_inclusive(self, by: Expr, n: usize) -> Expr

Available on crate feature dtype-struct only.

Split exactly n times by a given substring and keep the substring. The resulting dtype is DataType::Struct.

Source

pub fn splitn(self, by: Expr, n: usize) -> Expr

Available on crate feature 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.

Source

pub fn replace(self, pat: Expr, value: Expr, literal: bool) -> Expr

Available on crate feature regex only.

Replace values that match a regex pat with a value.

Source

pub fn replace_n(self, pat: Expr, value: Expr, literal: bool, n: i64) -> Expr

Available on crate feature regex only.

Replace values that match a regex pat with a value.

Source

pub fn replace_all(self, pat: Expr, value: Expr, literal: bool) -> Expr

Available on crate feature regex only.

Replace all values that match a regex pat with a value.

Source

pub fn reverse(self) -> Expr

Available on crate feature string_reverse only.

Reverse each string

Source

pub fn strip_chars(self, matches: Expr) -> Expr

Remove leading and trailing characters, or whitespace if matches is None.

Source

pub fn strip_chars_start(self, matches: Expr) -> Expr

Remove leading characters, or whitespace if matches is None.

Source

pub fn strip_chars_end(self, matches: Expr) -> Expr

Remove trailing characters, or whitespace if matches is None.

Source

pub fn strip_prefix(self, prefix: Expr) -> Expr

Remove prefix.

Source

pub fn strip_suffix(self, suffix: Expr) -> Expr

Remove suffix.

Source

pub fn to_lowercase(self) -> Expr

Convert all characters to lowercase.

Source

pub fn to_uppercase(self) -> Expr

Convert all characters to uppercase.

Source

pub fn to_titlecase(self) -> Expr

Available on crate feature nightly only.

Convert all characters to titlecase.

Source

pub fn to_integer(self, base: Expr, strict: bool) -> Expr

Available on crate feature string_to_integer only.

Parse string in base radix into decimal.

Source

pub fn len_bytes(self) -> Expr

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

When working with non-ASCII text, the length in bytes is not the same as the length in characters. You may want to use len_chars instead. Note that len_bytes is much more performant (O(1)) than len_chars (O(n)).

Source

pub fn len_chars(self) -> Expr

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

When working with ASCII text, use len_bytes instead to achieve equivalent output with much better performance: len_bytes runs in O(1), while len_chars runs in O(n).

Source

pub fn slice(self, offset: Expr, length: Expr) -> Expr

Slice the string values.

Source

pub fn head(self, n: Expr) -> Expr

Take the first n characters of the string values.

Source

pub fn tail(self, n: Expr) -> Expr

Take the last n characters of the string values.

Source

pub fn escape_regex(self) -> Expr

Available on crate feature regex only.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more