number of items?
Posted: Wed Mar 22, 2017 11:01 am
Can I count the numbers of items after setting the item delimiter?
Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Code: Select all
on mouseUp
put "A_B_C" into tVar
set the itemdel to "_"
put the num of items of tVar into tNbItems
set the itemdel to ","-- dont forget this
answer "Num of items of tVar =" && tNbItems
end mouseUp
as Jean-Marc already said, yes, this is surely possible!tusa wrote:Can I count the numbers of items after setting the item delimiter?
Code: Select all
...
put line 2 of the dgtext of grp "my wonderful datagrid" into aVar
## tVar now contains X number of items with TAB delimited
set itemdel to TAB
repeat with i= 1 to the num of items of tVar
put item i of tVar into tVar2
set itemdel to ";"
put "The num of items delimited with ; in item 1 of tVar = " & the num of items of tVar2 & CR after fld "Item info"
## IMPORTANT or the repeat loop will break:
set itemdel to TAB
end repeat
...