HomeManualTopicsTypesSymbols

std::before

returns the substring before the specified expression

Parameters

None

Results

None

Description

If the string specified as the first argument contains the expression specified as the second argument, the substring before the first match of the expression is returned.

If the string does not contain the expression then the empty string is returned.

An optional third argument can be used to match the nth occurence of the specified expression. If this value is negative then -1 means the last occurrence, -2 means the next-to-last occurence and so on.

Topic

Strings

See also

std::truncate_from returns the substring before the specified expression
std::between returns the substring between the two specified expressions
std::behind returns the substring behind the specified expression
std::from returns the substring starting with the specified expression
std::until returns the substring ending with the specified expression

Implemented by

std_types::string returns the substring before the specified expression