i think i'm doing a stupid error, but i can't catch it...can you please suggest me?
i launch this function
INTDotCommaCounter := 0;
INTIFrom := 0;
FOR i := 1 TO 1024 DO BEGIN
IF TXTLocLine[i] = ';' THEN
INTDotCommaCounter := INTDotCommaCounter + 1;
IF INTDotCommaCounter = 15 THEN
INTIFrom := i;
IF INTDotCommaCounter = 16 THEN
INTITo := i;
IF INTDotCommaCounter = 17 THEN BEGIN
TXTLocLine := INSSTR(TXTLocLine,'-',i);
END;
END;
TXTLocLine := DELSTR(TXTLocLine,INTIFrom,INTITo-INTIFrom);
EXIT(TXTLocLine);
passing this string as TXTLocLine parameter
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;24,60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
and i expect to receive this as result (no more 24,60 and a '-' added)
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
but instead i receive (24,6 instead of 24,60)
N;Fattura FV0701833;01833;20080422;01833;20080422;;Master Merci;Account Merci;;1;3;IV20;123,00;A;24,6;-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
i think i'm missing some positions in the string but i'm tired to change the numbers randomly and try...
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
Answers
within the loop, intifrom variable equals 98, but when performing delstrfunction, it equals 102... :-k :-k
can it be caused by insstr instruction??
EDIT: SOLVED!! I know it was really stupid...INTdotCommacounter is 15 until the next ';', so the value of intfrom is overwritten every time...
#-o
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog