syntax:functions:keepbefore
This is an old revision of the document!
KeepBefore(text, string)
Returns characters before the first occurrence of specific string in text. Parameter string must not be empty. This function is case-sensitive.
Example | Result |
---|---|
KeepBefore( '5pm', 'pm' ) | '5' |
keepbefore('October 2015','2015') | 'October ' |
The functions can have the optional third parameter with the index of the separator. The index can be negative - in this case, it's counted from the end of the text.
Example | Result |
---|---|
KeepBefore( 'a/b/c/d', '/', 2) | 'a/b' |
keepbefore( 'a/b/c/d', '/', -1) | 'a/b/c' |
See also
syntax/functions/keepbefore.1616540821.txt.gz · Last modified: 2021/03/23 19:07 by dmitry