Page 1 of 1

First character in a string

Posted: Fri Jan 25, 2013 3:43 pm
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.