User Tools

Site Tools


syntax:functions:pick

Differences

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

Link to this comparison view

Next revision
Previous revision
syntax:functions:pick [2016/06/20 11:27] – created dmitrysyntax:functions:pick [2021/09/13 23:00] (current) craigt
Line 1: Line 1:
-===== Pick(index, valuesseparator) =====+====== Pick(index, text_listdelimiter) =====
 +Category:  Special function
  
-Returns value from a list which is a text delimited by separator, by its index in the list.+\\  
 +=====Description===== 
 +This function returns the value in //index// position within //text_list//, a list of text values separated by //delimiter//
  
-Values in the delimited string are always considered text, even if they look like a number. Separator value may contain more than 1 character.+\\  
 +=====Use cases===== 
 +This function makes it possible to define EasyMorph expressions externally using parameters.
  
- Example   Result  +\\  
- pick(3, 'Please don’t stop the music', ' ')  stop  |+=====Arguments===== 
 +^Argument^Type^Description
 +|index|Number|The position of the value to return from //text_list//.| 
 +|text_list|Text|A text-based delimited list of values to search for //value//.| 
 +|delimiter|Text|The character(s) used to separate the individual values in //text_list// This can be more than one character.|
  
-=== See also ===+**Return value type:** Text 
 + 
 +\\  
 +=====Remarks===== 
 +Regardless of what the return value appears to be (number, Boolean, text), this function //always// returns a text value. 
 + 
 +The values in the delimited string (//text_list//) are always considered text, even if they look like a number. 
 + 
 +This function returns an empty value if //index// exceeds the number of delimited values in //text_list//
 + 
 +//Delimiter// may contain more than one character. 
 + 
 +\\  
 +=====Examples===== 
 + 
 +  pick(3, 'Please don’t stop the music', ' ' //Returns 'stop' 
 + 
 +  pick(2, '2,4,6,8,10,12', ',' //Returns '4'  (This is a text value, not a number.) 
 + 
 +  pick(5, 'Sally;Bob;Mary;Sue', ';' //Returns an empty value  (Only 4 values within the text list.) 
 + 
 + 
 +\\  
 +=====See also===== 
 +  * [[syntax:functions:in|In(text, look_in, delimiter)]] 
 +  * [[syntax:functions:match|Match(value, text_list, delimiter)]] 
 +  * [[transformations:group|Action: Group]]
  
-  * [[syntax:functions:in]] 
-  * [[syntax:functions:match]] 
-  * [[transformations:group|Group]] 
syntax/functions/pick.txt · Last modified: 2021/09/13 23:00 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki