Make replace, delete and "is" functions for strings

Share:

Description

Functions for building string functions for replacement, deletion and testing

Usage

1
2
3
make_str_replace(pattern, replacement)

make_str_delete(pattern)

Arguments

pattern

pattern to look for, as defined by a POSIX regular expression. See the "Extended Regular Expressions" section of regex for details. See fixed, ignore.case and perl for how to use other types of matching: fixed, case insensitive and perl-compatible expressions.

replacement

string. References of the form \1, \2 will be replaced with the contents of the respective matched group (created by ()) within the pattern.

These functions build functions that take a single string argument and return a vector as a result.

make_str_replace builds a functions that replaces the strings according to the pattern and replacement arguments.

make_str_delete builds a functions that deletes the pattern from the string.

make_str_is builds a function that detects is the string is has a certain type of formatting.

Examples

1
# -tk