I haven't found any post on this bug. The right$ function doesn't work properly with >32k strings.
This code show the bug:
CONST CRLF=CHR$(13)+CHR$(10)
DIM ww AS STRING, i AS INTEGER
SUB testit
ww=""
DO
ww=ww+STR$(LEN(ww))+"-"
LOOP UNTIL LEN(ww)>10000
SHOWMESSAGE "LEN="+STR$(LEN(ww))+CRLF+CRLF+"RIGHT$" + CRLF +RIGHT$(ww,20) + CRLF + CRLF+"MID$" + CHR$(13)+CHR$(10)+MID$(ww,LEN(ww)-19,20)
DO
ww=ww+STR$(LEN(ww))+"-"
LOOP UNTIL LEN(ww)>20000
SHOWMESSAGE "LEN="+STR$(LEN(ww))+CRLF+CRLF+"RIGHT$" + CRLF +RIGHT$(ww,20) + CRLF + CRLF+"MID$" + CHR$(13)+CHR$(10)+MID$(ww,LEN(ww)-19,20)
DO
ww=ww+STR$(LEN(ww))+"-"
LOOP UNTIL LEN(ww)>30000
SHOWMESSAGE "LEN="+STR$(LEN(ww))+CRLF+CRLF+"RIGHT$" + CRLF +RIGHT$(ww,20) + CRLF + CRLF+"MID$" + CHR$(13)+CHR$(10)+MID$(ww,LEN(ww)-19,20)
DO
ww=ww+STR$(LEN(ww))+"-"
LOOP UNTIL LEN(ww)>40000
SHOWMESSAGE "LEN="+STR$(LEN(ww))+CRLF+CRLF+"RIGHT$" + CRLF +RIGHT$(ww,20) + CRLF + CRLF+"MID$" + CHR$(13)+CHR$(10)+MID$(ww,LEN(ww)-19,20)
DO
ww=ww+STR$(LEN(ww))+"-"
LOOP UNTIL LEN(ww)>50000
SHOWMESSAGE "LEN="+STR$(LEN(ww))+CRLF+CRLF+"RIGHT$" + CRLF +RIGHT$(ww,20) + CRLF + CRLF+"MID$" + CHR$(13)+CHR$(10)+MID$(ww,LEN(ww)-19,20)
END SUB
CREATE Form AS QFORM
CAPTION = "Form1"
Width = 320
Height = 240
Center
CREATE Button1 AS QBUTTON
CAPTION = "Button1"
Left = 82
Top = 48
onclick=testit
END CREATE
END CREATE
Form.SHOWMODAL
Greetings Lupo |