First character in a string

Questions about the BASICtools and MakeItC
Post Reply
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

First character in a string

Post by YahooArchive »

Visual BASIC is a bit inconsistent on this.

Arrays are all 0 based in VB.

VB accesses the first character by Stringname.Chars(0) In ARMbasic that first
character is accessed by Stringname(0)

But VB's MID ("This is a string",1,3) returns "Thi".

The existing library of string functions was translated from C, which is always
0 based for the first element. So

MIDSTR ("This is a string",1,3) returns "his"

To either add to the confusion or straighten it out, the existing
library will not be changed, but a new library called
will be added to implement VB style MID, INSTR, UCASE and LCASE.
The first 2 will be 1 based indexing; UCASE and LCASE do not care.

Post Reply