Module string

Module string 

Source
Expand description

String manipulation helpers. Pan string formatting and slicing helpers.

Modules§

funnel
Funnel-style substring extraction helpers. Funnel-style substring extraction.
numeric
Numeric string helpers. Pan numeric string helpers.
pattern
Numeric formatting with Pan pattern syntax. Pan numeric pattern formatting.
stringmod
Additional string manipulation helpers. Additional Pan string utilities.

Functions§

after
Returns the substring after the first occurrence of tag.
before
cat
Concatenates two strings.
contains
Returns true if substring is present in text.
firstline
Returns the first line split by \n.
lastline
Returns the last line split by \n.
lastword
Returns the last whitespace-delimited word.
left
Returns the leftmost len characters.
length
Returns the number of Unicode scalar values in text.
linecount
Returns the number of \n-delimited lines.
mid
Returns len characters starting at the 1-based start position.
nthline
Returns the 1-based line number num, or empty if missing.
nthword
Returns the 1-based word number num, or empty if missing.
rangecontains
Returns true if any character is within the range pairs. For instance, “AZaz” means ‘A’..=‘Z’ and ‘a’..=‘z’.
rangematch
Returns true if every character is within the range pairs. For instance, “AZaz” means ‘A’..=‘Z’ and ‘a’..=‘z’.
removeprefix
Removes prefix when present.
removesuffix
Removes suffix when present.
rep
Repeats text count times.
right
Returns the rightmost len characters.
sandwich
Wraps root with prefix and suffix when root is non-empty. For example: a, b, c -> “abc”; a, “”, c -> “”.
search
Returns the 1-based character index of phrase, or 0 if missing.
snip
Removes a slice starting at the 0-based startposition.
textafter
Returns the substring after tag, or text when not found.
textbefore
trim
Removes len characters from the end of text.
trimleft
Removes len characters from the start of text.
wordcount
Returns the number of whitespace-delimited words.