Could the reference be the SBASIC/SuperBASIC reference manual? That says When a string array is set up with DIM, each entry is set to a nul string (“”). The zero’th element of each string array contains the actual length of that string, for example: DIM a$(10,10): a$(1)='Hello': PRINT a$(1,0) will return the value 5, as will PRINT LEN(a$(1)). If a$ is undimensioned and a$=’Hello World’, PRINT a$(0) does not generally work and will result in an ‘Out of Range’ error, except under SMS v2.60+ and Minerva where PRINT a$(0) is the same as PRINT LEN(a$).
John On Fri, 12 Jan 2024 at 17:04, Jan Bredenbeek via Ql-Users < [email protected]> wrote: > On 12-01-2024 16:20, Norman Dunbar via Ql-Users wrote: > > > > > If I remember correctly, all the way back to 1984-85, I'm almost > > certain that the supplied QL manual, in the large, heavy, A$ folder, > > mentioned that string lengths are indeed stored in a$(0)---or at > > least, can be accessed from there. > > > > Cheers, > > Norm. > > > > Page 46 of the Concepts section mentions that 'under certain > circumstances' it is possible to refer to more than one element in an > array (i.e. slice the array), and that the term 'array' in this context > can include a numerical array, a string array or a simple string. It > also mentions that the slice (0 TO) means the full range of elements. > > Whilst it is indeed possible to slice an array (which includes element > 0), this is not true for simple strings. Using slice (0 TO) of a simple > string always produces an 'out of range' error. > Under Minerva and SMSQ/E, a$(0) indeed returns the length of a$. At > least version JS returns an error when trying to access element 0 of a > simple string. > > -- > Jan Bredenbeek | Hilversum, NL | [email protected] > > _______________________________________________ > QL-Users Mailing List > _______________________________________________ QL-Users Mailing List
