User Tools

Site Tools


tutorials:faq:main

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:faq:main [2019/08/02 17:10]
henningw [General]
tutorials:faq:main [2019/11/19 15:52] (current)
miconda
Line 516: Line 516:
 ??? How to iterate through the items in a comma separated string? ??? How to iterate through the items in a comma separated string?
  
-!!! If you have a variable holding a string like "​a,​b,​c,​d"​ and want to get each character separately, you have to use a WHILE loop and {s.select,​index,​separator} ​transformationIf there is no value at the given index, then the transformation will return $nullthus you have to use a variable as index, ​incrementing it until you get a $null.+!!! If you have a variable holding a string like "​a,​b,​c,​d"​ and want to get each character separately, you have to use a WHILE loop with {s.count,​separator} ​and {s.select,index,separator} transformations.
  
 Here is an example: Here is an example:
Line 523: Line 523:
 $var(x) = "​a,​b,​c,​d";​ $var(x) = "​a,​b,​c,​d";​
 $var(i) = 0; $var(i) = 0;
 +$var(n) = $(var(x){s.count,,​});​
  
-while( $(var(x){s.select,$var(i),,​})!=$null ​) {+while( $var(i<= $var(n) ) {
    ​xlog("​token at position $var(i) is: $(var(x){s.select,​$var(i),,​})\n"​);​    ​xlog("​token at position $var(i) is: $(var(x){s.select,​$var(i),,​})\n"​);​
    ​$var(i) = $var(i) + 1;    ​$var(i) = $var(i) + 1;
tutorials/faq/main.1564758615.txt.gz ยท Last modified: 2019/08/02 17:10 by henningw