User Tools

Site Tools


syntax:functions:keepafter

KeepAfter(text, after_string)

Category: Text function


Description

This function returns characters after the first occurrence of after_string in text, if found. If after_string is not found within text and "empty" value is returned.


Alternative syntax

This function can take an optional third numeric parameter to define the instance of after_string used in the search. If instance_num is negative, the match starts from the end of text.

KeepAfter(text, after_string, instance_num)


Arguments

ArgumentTypeDescription
textTextThe text value to search within for the after_string string.
after_stringText (must not be empty)The text string to search for within text. The characters after this string are returned.
instance_num*Number (non-zero integer)The occurrence of after_string to use as the delimiter to return the text following.

*Optional argument.

Return value type: Text


Remarks

This function is case sensitive.

text and after_string are implicitly converted to text values if required.


Examples

keepafter('a/b/c/d', 'b') //Returns '/c/d'
keepafter('a/b/c/d', '/') //Returns 'b/c/d'
keepafter('a/a/b/b/c/d', 'b/') //Returns 'b/c/d'  (Second argument can be multiple characters)
keepafter('a/b/c/d', '/', 2) //Returns 'c/d'  (Keep text after the second instance of '/')
keepafter('a/b/c/d', '/', -1) //Returns 'd'  (Keep text after the first instance of '/', from the end)
keepafter('a/b/c/d', 'z') //Returns (empty)  ('z' not found within the text value)


See also

syntax/functions/keepafter.txt · Last modified: 2021/12/23 05:35 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki