User Tools

Site Tools


syntax:functions:keepafter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
syntax:functions:keepafter [2021/03/23 19:08] dmitrysyntax:functions:keepafter [2021/08/02 01:11] craigt
Line 1: Line 1:
-====== KeepAfter(text, string) ======+====== KeepAfter(text, after_string) ====== 
 +Category:  Text function
  
-Returns characters after the first occurrence of specific //string// in //text//Parameter //string// must not be empty+\\  
-This function is case-sensitive+=====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.
  
-^  Example  ^  Result  ^ +\\  
- keepafter( 'New York''Y' )  |  ork  | +=====Alternative syntax===== 
- keepafter'Food&Beverage''&'   Beverage  |+This function can take an optional third numeric parameter to define the instance of //after_string// used in the search.  If //instance_num// is negativethe match starts from the end of //text//. 
 +  KeepAfter(textafter_string, instance_num)
  
-The functions can have the optional third parameter with the index of the separatorThe index can be negative - in this case, it's counted from the end of the text.+\\  
 +=====Arguments===== 
 +^Argument^Type^Description^ 
 +|text|Text|The text value to search within for the //after_string// string.
 +|after_string|Text (must //not// be empty)|The text string to search for within //text// The characters after this string are returned.| 
 +|instance_num<sup>*</sup>|Number|The occurrence of //after_string// to use as the delimiter to return the text following.| 
 +<sup>*</sup>Optional argument.
  
- Example   Result  ^ +**Return value type:** Text 
- keepafter( 'a/b/c/d', '/', 2)  |  'c/d'  | + 
- keepafter( 'a/b/c/d', '/', -1)   'd'  |+\\  
 +=====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') = '/c/d' 
 +  keepafter('a/b/c/d', '/') = 'b/c/d' 
 +  keepafter('a/a/b/b/c/d', 'b/') = 'b/c/d'  //Second argument can be multiple characters 
 +  keepafter('a/b/c/d', '/', 2) 'c/d'  //Keep text after the second instance of '/' 
 +  keepafter('a/b/c/d', '/', -1) = 'd'  //Keep text after the second instance of '/', from the end 
 +  keepafter('a/b/c/d', 'z') = (empty)  //'z' not found within the text value 
 + 
 +\\  
 +===== See also ===== 
 +  * [[syntax:functions:keepbefore|KeepBefore(text, before_string)]] 
 +  * [[syntax:functions:removeend|RemoveEnd(text, remove_num)]]
  
-=== See also === 
-  * [[syntax:functions:keepbefore]] 
-  * [[syntax:functions:removeend]] 
syntax/functions/keepafter.txt · Last modified: 2021/12/23 05:35 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki