Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: LET string1 = string1 ( 1 TO LEN string1) (solved)
#1
In my program I had

DIM EDLINE AS STRING ' global variable

and if I wrote

EDLINE = EDLINE( TO LEN EDLINE-2)

then the test

EDLINE = ""

it didn't always work

and I had to use

LEN EDLINE = 0


Then I changed it to

aux = EDLINE( TO LEN EDLINE-2)
EDLINE = aux

and the test

EDLINE = ""

worked well.
Reply
#2
Interesting... My guess is that if EDLINE is just 1 char, then LEN EDLINE - 2 is becoming 65535 (-1 as UInteger). 65535 which means However, after further investigation, this code (note, you can use [code] ... [/code] for code sections in the forum):

Code:
DIM EDLINE As String
LET EDLINE$ = "X"
X = EDLINE( TO LEN EDLINE -2)

PRINT "'";EDLINE;"' '";X;"'"
PRINT X = ""
PRINT LEN X = 0

This code should print
Code:
65535
'1' ''
1
1

it prints:
Code:
65535
'1' ''
0
1

instead. Will look into this, thanks!
Reply
#3
Okay, try this beta, and plz. let me know if it works ok: Shy
http://www.boriel.com/files/zxb/zxbasic-...a15.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...beta15.zip
http://www.boriel.com/files/zxb/zxbasic-...-win32.zip
http://www.boriel.com/files/zxb/zxbasic-...x64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...cos.tar.gz
Reply
#4
Works

Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)