bandi
(Fresh Scripter)
2004-02-08 02:34 PM
SPLIT command

Hello,
While using Kix script, I need to make some calculations on data of a file. The file contains a single line with many fields, seperated by space (for example "AAAA 34 52 1 4 7 2 31 56 89"). I need to isolate only some fields and have its value on variables (for example I need the variable count1 to have the value of the fifth element and the variable count2 to have the value of the third variable).
Can someone help me with this?

Thanks


Les
(KiX Master)
2004-02-08 03:37 PM
Re: SPLIT command

I thought the manual did justice to Split().
Code:
break on

$Field=Split("AAAA 34 52 1 4 7 2 31 56 89")
$count1=$Field[4]
$count2=$Field[2]
'count1 = '+$count1 ?
'count2 = '+$count2 ?
get $_



Radimus
(KiX Supporter)
2004-02-08 04:13 PM
Re: SPLIT command

additionally:

break on
$Field=Split("AAAA 34 52 1 4 7 2 31 56 89")

for each $element in $field
? $element
next

for $item = 0 to ubound($field)-1
? $item + ' = '+$field[$item]
next