PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Inconsistency with "mid" and "pos" funct

Hi Kornalius,

I think I have found an inconsistency between the "Help" documentation and the actual "mid" and "pos" functions.

In the following code example:

Code:

test$ = "abcdef";
ext$ = mid(test$,3,2);
showmessage(ext$);


the "Help" file suggests that EXT$ => "cd" where as in fact it is set to "de" ... eg: the indexing is "zero" based.

A simialr scenario is also true for "pos" function:

Code:

i$ = Pos("BCD", "ABCDEF");
ShowMessage(i$);


results in i$ = "1"; NOT "2" as per "Help" documentation.

I also note that for

Code:

i$ = Pos("PQR", "ABCDEF");
ShowMessage(i$);


returns i$ = "6".

This is not a very "logical" choice for failure and makes generic testing "difficult". "-1" would have made a better failure return.

All of this is inconsistent with the equivelent (or near equivelent) constructs in other languages. I think it needs high-lighting in the documentation. Learning was a slow painful process!

regards
Hi,

I will fix the help file. thanx