Splitstr speedup?
Posted: Sat Jun 12, 2010 8:01 am
Hello,
This was my original question asked on the mailing list
---
Hello,
I'm currently trying to read datas from an ASCII file.
No problem to open the file but I' don't know how can I read datas and
insert them in many tables
This is an example from my file
1869 - History Experience Part I (AGA);Flair; Max Design;Wilfried Reiter,
Albert Lasser & Martin Lasser;Hannes Seifert;Martin Lasser & Wilfried
Reiter;Straté gie-Commerce; 1 à 4;1993;AGA;no; no;no;4;Anglais; Flair;no; no;
Datas are separated with ";"
Full ASCII file contains 1824 lines
Structure is in fact
Game's
Name;Publisher; Developer; Coder;Musican; Artist;Type; Players;Config; CPUBlit;IBlit; 8Mo;Discs; Langage;Publisher;
Logo;Youtube; WHD;Code; Year;Exclusion Tag
But how can I read datas and assign first data to Game, second data to
publisher, ect...?
I've started ro read documentation for Seek() command but don't
understand how to use it in my case.
---
@Rev. Bloedel said to me "Check out the documentation for SplitStr()."
I've watched documentation and code this piece of software
Dim chainejx$[5000]
Dimstr titre[5000], editeur[5000], dev[5000], codeur[5000], gfx[5000], mus[5000], genre[5000]
Dimstr joueur[5000], config[5000], cpu[5000], iblit[5000], hmo[5000], lang[5000], logoed[5000], youtube[5000], WHD[5000], code[5000]
Dim annee[5000], nbdisk[5000], chainelng$[1000]
OpenFile(1,fichier$, #MODE_READ)
info=GetFileAttributes(fichier$)
taille=(FileLength(1))
; Reads numer of games and lines
nbdata=Nil
donnees$=ReadString(1, FileLength(1))
ligne, nbdata=SplitStr(donnees$, "\n")
For Local compt=1 To nbtitres-1
chainejx$[compt]=SplitStr(donnees$, "\n")
For Local compt1=1 To nbtitres-1
jeux = SplitStr(ligne[compt1], ";")
titre[compt1]=jeux[0]
editeur[compt1]=jeux[1]
dev[compt1]=jeux[2]
codeur[compt1]=jeux[3]
mus[compt1]=jeux[4]
gfx[compt1]=jeux[5]
genre[compt1]=jeux[6]
joueur[compt1]=jeux[7]
annee[compt1]=jeux[8]
config[compt1]=jeux[9]
cpu[compt1]=jeux[10]
iblit[compt1]=jeux[11]
hmo[compt1]=jeux[12]
nbdisk[compt1]=jeux[13]
lang[compt1]=jeux[14]
logoed[compt1]=jeux[15]
youtube[compt1]=jeux[16]
whd[compt1]=jeux[17]
code[compt1]=jeux[18]
Next
Next
This code works but is VERY slow! I'm working on a file wich contains about 1800 lines to check and split.
Is there any way to speedup this?
Thanks for advance!
This was my original question asked on the mailing list
---
Hello,
I'm currently trying to read datas from an ASCII file.
No problem to open the file but I' don't know how can I read datas and
insert them in many tables
This is an example from my file
1869 - History Experience Part I (AGA);Flair; Max Design;Wilfried Reiter,
Albert Lasser & Martin Lasser;Hannes Seifert;Martin Lasser & Wilfried
Reiter;Straté gie-Commerce; 1 à 4;1993;AGA;no; no;no;4;Anglais; Flair;no; no;
Datas are separated with ";"
Full ASCII file contains 1824 lines
Structure is in fact
Game's
Name;Publisher; Developer; Coder;Musican; Artist;Type; Players;Config; CPUBlit;IBlit; 8Mo;Discs; Langage;Publisher;
Logo;Youtube; WHD;Code; Year;Exclusion Tag
But how can I read datas and assign first data to Game, second data to
publisher, ect...?
I've started ro read documentation for Seek() command but don't
understand how to use it in my case.
---
@Rev. Bloedel said to me "Check out the documentation for SplitStr()."
I've watched documentation and code this piece of software
Dim chainejx$[5000]
Dimstr titre[5000], editeur[5000], dev[5000], codeur[5000], gfx[5000], mus[5000], genre[5000]
Dimstr joueur[5000], config[5000], cpu[5000], iblit[5000], hmo[5000], lang[5000], logoed[5000], youtube[5000], WHD[5000], code[5000]
Dim annee[5000], nbdisk[5000], chainelng$[1000]
OpenFile(1,fichier$, #MODE_READ)
info=GetFileAttributes(fichier$)
taille=(FileLength(1))
; Reads numer of games and lines
nbdata=Nil
donnees$=ReadString(1, FileLength(1))
ligne, nbdata=SplitStr(donnees$, "\n")
For Local compt=1 To nbtitres-1
chainejx$[compt]=SplitStr(donnees$, "\n")
For Local compt1=1 To nbtitres-1
jeux = SplitStr(ligne[compt1], ";")
titre[compt1]=jeux[0]
editeur[compt1]=jeux[1]
dev[compt1]=jeux[2]
codeur[compt1]=jeux[3]
mus[compt1]=jeux[4]
gfx[compt1]=jeux[5]
genre[compt1]=jeux[6]
joueur[compt1]=jeux[7]
annee[compt1]=jeux[8]
config[compt1]=jeux[9]
cpu[compt1]=jeux[10]
iblit[compt1]=jeux[11]
hmo[compt1]=jeux[12]
nbdisk[compt1]=jeux[13]
lang[compt1]=jeux[14]
logoed[compt1]=jeux[15]
youtube[compt1]=jeux[16]
whd[compt1]=jeux[17]
code[compt1]=jeux[18]
Next
Next
This code works but is VERY slow! I'm working on a file wich contains about 1800 lines to check and split.
Is there any way to speedup this?
Thanks for advance!