New topic: 

from string to array of integers

<http://forums.realsoftware.com/viewtopic.php?t=39287>

         Page 1 of 1
   [ 2 posts ]                 Previous topic | Next topic          Author  
Message        juanolle          Post subject: from string to array of 
integersPosted: Thu Jun 02, 2011 6:50 am                         
Joined: Mon Apr 19, 2010 1:08 pm
Posts: 4                I have array of integers that needs to be populated 
with string that i read from textfile.
Is there any easy way to do it?
Line is like this:
1,3,56,6,188
and i read it to string like this:
Code:dim zdata as string
dim intArray() as integer
zdata=t.ReadLine(encodings.UTF8)

I have tryed to populate intArray() with array function but it can't understand 
numbers as integers...   
                             Top                 capaho          Post subject: 
Re: from string to array of integersPosted: Thu Jun 02, 2011 7:04 am            
             
Joined: Fri Jul 21, 2006 12:28 am
Posts: 310                Try this:
Code:dim zdata() as string
dim intArray(),i as integer
zdata = Split(t.ReadLine(encodings.UTF8),",")
For i = 0 to Ubound(zdata)
 intArray.Append Val(zdata(i))
Next      
_________________
Regards,
Carl
Capaho Web
http://www.capaho.com  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 2 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to