strings

stdlib::rss::strings

String comparison, searching, splitting, trimming, and replacement helpers.

Import

use stdlib::rss::strings;

Functions

FunctionDescription
equalsReturns whether two strings are equal.
is_emptyReturns whether a string is empty.
non_emptyReturns whether a string is not empty.
containsReturns whether a string contains a substring.
splitSplits a string on a separator.
trimTrims leading and trailing ASCII whitespace from a string.
replaceReplaces all matching substrings in a string.

Function details

equals

pub fn equals(lhs: string, rhs: string) -> bool

Returns whether two strings are equal.

is_empty

pub fn is_empty(value: string) -> bool

Returns whether a string is empty.

non_empty

pub fn non_empty(value: string) -> bool

Returns whether a string is not empty.

contains

pub fn contains(haystack: string, needle: string) -> bool

Returns whether a string contains a substring.

split

pub fn split(value: string, separator: string) -> [string]

Splits a string on a separator.

trim

pub fn trim(value: string) -> string

Trims leading and trailing ASCII whitespace from a string.

replace

pub fn replace(value: string, needle: string, replacement: string) -> string

Replaces all matching substrings in a string.