Active Forums => QB64 Discussion => Topic started by: MLambert on March 11, 2020, 03:52:46 am
Title: INSTR and LEN Question
Post by: MLambert on March 11, 2020, 03:52:46 am
The following is a simple program
C = 20 / 3
PRINT C
C$ = STR$(C)
Z = INSTR(1, STR$(C), ".") PRINT Z
Z = INSTR(1, C$, ".") PRINT Z
Z = LEN(C) PRINT Z
Z = LEN(C$) PRINT Z
Can someone tell me why the INSTR is not showing the correct position of the decimal point and why is the length of the fields not correct ?
Mike
Title: Re: INSTR and LEN Question
Post by: visionmercer on March 11, 2020, 04:23:27 am
STR$ returns the number with a leading space or minus The LEN function returns the number of bytes used by a variable value and the number of characters in a STRING.
Title: Re: INSTR and LEN Question
Post by: MLambert on March 11, 2020, 07:46:59 am
thanks .. what about the INSTR ??
Title: Re: INSTR and LEN Question
Post by: STxAxTIC on March 11, 2020, 11:33:58 am
Probably looking at invisible spaces. Use LTRIM$(RTRIM$()) right after conversion to a string.
Title: Re: INSTR and LEN Question
Post by: _vince on March 11, 2020, 11:53:39 am