extractAfter

Extracts the text that follows a marker or a position.

Category: Language Fundamentals > Data Types

Syntax

newStr = extractAfter(str, pat)

Returns what follows the first occurrence of pat.

newStr = extractAfter(str, pos)

Returns the characters after position pos.

Description

The marker itself is not part of the result. Use it to split a key=value entry: extractAfter(s, "=") gives the value and extractBefore(s, "=") gives the key.

Input arguments

str
Text to search.
pat
Marker text or pattern. Only the first match counts.
pos
Positive integer: how many leading characters to skip.

Output arguments

newStr
The remainder of the text, as a string (or the type of str). If pat is not found the result is a missing string.

Example

Text after a marker

extractAfter("abc=def=ghi", "=")
extractAfter("abcdef", 2)
Output
ans = "def=ghi"
ans = "cdef"

See also

extractBefore extractBetween extract eraseBetween insertAfter