| |
|
|
Matthias Badzun | Moin moin,
i'm Umsteiger of Turbo-/Power-Basic with well 10-jährigem "Schaffensloch" and I therefore a problem (V.11 Full Version)
I must Variabele a on itself sequenziellen File reading, The but some Lines contains in them several Variabele with Kommata separated vorkommen. Number and type this Variabelen is in this Lines always same, Strings and numbers mixed, Strings are additional within "".
example: -------------------------------------------------------- 15840 1 13,13,6,20,11,12,15 550 595 600 385 390 1,81074,36626,"Herr",36526,"Unbekannt","Diagnose","€","Schlusstext, 2. Zeile" 3 --------------------------------------------------------
The strings can also Sonderzeichen, point and Kommata as well as <LF> and <CR> include, but no "" within one Stringtextes. The Textlängen are vaguely.
with my middle-aged Basic-mutants was no trouble (unfortunately but not windows-capable), but in XProfan 11 have I moreover yet nothing funktionierendes discover. but there it Yes "geht nicht" not gives, can me certainly someone moreover help.
beforehand many Thanks Greeting, Matthias |
|
|
| |
|
|
|
Christian Eichler | what I personally, as someone the straight on C umsteig, in this drop make would is the following:
i'd each letters particular vergleichen and thereby The " mitzählen. is The Number of " ungerade is the , inside the ", is tappt im dunkeln straight deals it itself objectively for a Trennkomma.
this is blos ne spontane idea of me been.
BTW: Überprüfen, whether a number straight or not can wonderful with Modulo 2
Regards Christian |
|
|
| Debian Lenny, Intel Celeron 2,8 Ghz, 768 MB Ram && Win XP Pro, Intel C2D 1,66Ghz, 2 GB Ram ... PROFAN² 6.6 | 12/08/08 ▲ |
|
|
|
|
Frank Abbing | are each Lines through <CR> separated? is naturally everything machbar, only are missing another couple Info. If the Files not straight gigantic tall are, would I tappt im dunkeln in a area loading and then parsen. |
|
|
| |
|
|
|
Matthias Badzun | The Files can 300~400 kB big his, teoretisch too larger but in the practice sooner not. The Lines are through <CR><LF> separated. but inerhalb the Strings can ditto <CR><LF> as Line break in the Klartext to come, which in EDITOR so present. The can then naturally not as end the Datenzeile interprets go. |
|
|
| |
|
|
|
Dietmar Horn | Hello Matthias,
i'd The File sequentiell reading and each Line in of/ one Loop with SubStr$ durchforsten (with comma as Separator), To nothing more comes (see XProfan-Help Substr$).
The strings erkennst You then Yes on whom quotation marks, The You with Instr to check on can. with only 300 To 400 KB should the 1-2-fix weg.
there might then too <CR><LF> inside the Strings not disturbing.
Greeting Dietmar |
|
|
| Multimedia für Jugendliche und junge Erwachsene - MMJ Hoyerswerda e.V. [...] Windows 95 bis Windows 7 Profan² 6.6 bis XProfan X2 mit XPSE Das große XProfan-Lehrbuch: [...] | 12/08/08 ▲ |
|
|
|
|
Frank Abbing | Yes, comes <CR><LF> within quotation marks to, find tappt im dunkeln itself in in the string. otherwise separate tappt im dunkeln each Lines voneinander ex. i'd everything in a area reading and zeichenorientiert parsen. |
|
|
| |
|
|
|
| Matthias Badzun
I must Variabele a on itself sequenziellen File reading, The but some Lines contains in them several Variabele with Kommata separated vorkommen. Number and type this Variabelen is in this Lines always same, Strings and numbers mixed, Strings are additional within "". The strings can also Sonderzeichen, point and Kommata as well as <LF> and <CR> include, but no "" within one Stringtextes. The Textlängen are vaguely.
would be I by aray solve.
Have "einladen" and "getxy" on obiges adjusted, that with the whom Strings works. CompileMarkSeparation {$cleq}
//globale
strings myData.strings,
myData=myData.loadFromString(fgc("meineDatei"))
//fenster
cls
//testen
print "Zeilen:",sizeOf(myData)
print "1,1:",myData.getxy(1,1)
print "3,3:",myData.getxy(3,3)
print "1,5:",myData.getxy(1,5)
print "3,9:",myData.getxy(3,9)
print "4,9:",myData.getxy(4,9)
print "6,9:",myData.getxy(6,9)
waitInput
end
myData.loadFromString(string data){
clear myData.strings
strings lns=explode(data,"q")
long c=sizeOf(lns)
case (c==0) : case (lns[0]=="") : return lns
data=""
whileLoop 0,c-1 {
ifnot (loop mod 2) {
data=data+lns[loop]
} else {
myData.strings[sizeOf(myData.strings)]=lns[loop]
data=data+"q"+str$(int(sizeOf(myData.strings)))+"q"
}
}
strings nData=explode(data,"
")
return nData
}
myData.getxy(long x,y){
y-
string s=substr$(myData$[y],x,",")
casenot mid$(s,1,1)=="q" : return s
long n=val(del$(s,1,1))
casenot n : return ""
return myData.strings[n-1]
}
fgc(string fle){
long fh=assign(fle)
casenot fh : return ""
reset #fh
string s,_out
whileNot eof(fh) {
input #fh,s
_out=_out+s
casenot eof(fh) : _out=_out+"
"
}
close fh
assign fh,""
return _out
}
or. CompileMarkSeparationDECLARE MYDATA.STRINGS$[]
DECLARE MYDATA$[]
MYDATA$[]=MYDATA.LOADFROMSTRING(FGC("meineDatei"))
CLS
PRINT "Zeilen:",SIZEOF(MYDATA$[])
PRINT "1,1:",MYDATA.GETXY(1,1)
PRINT "3,3:",MYDATA.GETXY(3,3)
PRINT "1,5:",MYDATA.GETXY(1,5)
PRINT "3,9:",MYDATA.GETXY(3,9)
PRINT "4,9:",MYDATA.GETXY(4,9)
PRINT "6,9:",MYDATA.GETXY(6,9)
WAITINPUT
end
proc MYDATA.LOADFROMSTRING
PARAMETERS DATA$
DECLARE LNS$[]
CLEAR MYDATA.STRINGS$[]
LNS$[]=EXPLODE(DATA$,"q")
var C&=SIZEOF(LNS$[])
IF (C&=0)
IF (LNS$[0]="")
RETURN LNS$[]
ENDIF
ENDIF
DATA$=""
WHILELOOP 0,C&-1
IFNOT (&LOOP MOD 2)
DATA$=DATA$+LNS$[&LOOP]
ELSE
MYDATA.STRINGS$[SIZEOF(MYDATA.STRINGS$[])]=LNS$[&LOOP]
DATA$=DATA$+"q"+STR$(INT(SIZEOF(MYDATA.STRINGS$[])))+"q"
ENDIF
ENDWHILE
DECLARE NDATA$[]
NDATA$[]=EXPLODE(DATA$,"
")
RETURN NDATA$[]
endproc
proc MYDATA.GETXY
PARAMETERS X&,Y&
DEC Y&
var s$=SUBSTR$(MYDATA$[Y&],X&,",")
IFNOT MID$(s$,1,1)="q"
RETURN s$
ENDIF
var N&=VAL(DEL$(s$,1,1))
IFNOT N&
RETURN ""
ENDIF
RETURN MYDATA.STRINGS$[N&-1]
endproc
proc FGC
PARAMETERS FLE$
var FH&=ASSIGN(FLE$)
IFNOT FH&
RETURN ""
ENDIF
RESET #FH&
var s$=""
var _OUT$=""
WHILENOT EOF(FH&)
INPUT #FH&,s$
_OUT$=_OUT$+s$
IFNOT EOF(FH&)
_OUT$=_OUT$+"
"
ENDIF
ENDWHILE
CLOSE FH&
ASSIGN FH&,""
RETURN _OUT$
endproc
|
|
|
| |
|
|
|
Matthias Badzun | Vielen Thanks you all for different ideas. so far I The with my yet right bescheidenen XProfan-Kenntnissen understand could Have I tappt im dunkeln ausprobiert. there into Textfeldern Kommata vorkommen goes substr$ not - the mach then there one new area on and moreover hinten stehende then not any more red. means had I still The row first of all complete reading and then byte for byte auspicken. Irgendwas hakt of course yet sometimes at again-zusammenbau the Texts in a new String, must with the Feldinhalt concern, but at least Have I already time any my boxes again in individual Variabelen.
glad Festtage and good Slip for all
Matthias |
|
|
| |
|
|
|
| In my Posting (2 high) stand two working (tested) Solutions, like not?
(naja, heavy To overlooking ists Yes not there einziger code here in the Thread *g*)
On german: The code shows still as working and is additionally very quick. |
|
|
| |
|
|
|
Matthias Badzun | like tät I The already, but since reicht my profanes XProfan-know yet long not from around the To understand. If then in the practice what aneckt Have I no chance, The causes To discover. so integrally gradually stoße I here on The Equivalente to that Altgelernten. but a couple Progrämmle must I me well yet rausquälen circa again fit To go. nevertheless many Thanks for these Scripte, are on the disk, but not yet in the Hirn see you soon, until next Hose, on the I a while ausharre |
|
|
| |
|
|
|
| You are welcome!
If ask come into being...
but Perhaps could yes a Geübter obigen code something humanisieren. |
|
|
| |
|
|