LEN function

Purpose: LEN returns the number of characters in a string.


Syntax:

 RetVal% = LEN(MainStr$)

Parameters:

  • MainStr$ String to be measured for length.

Return Value:

  • RetVal%, the return value, is the number of characters in MainStr$.

Example:


 DIM a$
 DIM i%

 FOR i% = 65 TO 65+25
  a$ = a$ & CHR$(i%)
 NEXT

 i% = LEN(a$)

 ? "The length of a$ = " , i%

Result:


 The length of a$ =  26

BCX Console Sample Programs using LEN function.

S04.bas, S16.bas, S17.bas, S23.bas, S32.bas, S39.bas, S41.bas, S42.bas, S54.bas, S79.bas, S84.bas, S94.bas, S105.bas, S110.bas, S113.bas, S115.bas, S119.bas, S126.bas, S128.bas