Page 1 of 1 1
Topic Options
#113585 - 2004-02-08 02:34 PM SPLIT command
bandi Offline
Fresh Scripter

Registered: 2004-02-08
Posts: 6
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

Top
#113586 - 2004-02-08 03:37 PM Re: SPLIT command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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 $_

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#113587 - 2004-02-08 04:13 PM Re: SPLIT command
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.055 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org