Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF

254 LEN length (of a string) Purpose This function counts the number of characters in a string. For example K=LEN("FRIDAY ") would give K=7 since there are six letters in "FRIDAY" and it is followed by a space. This function is often used with a FOR...NEXT loop to do something once for each letter in a string. For example, we might wish to encode a word by replacing each letter with its successor in the alphabet so that, for example, "FRIDAY" would become "GSJEBZ" . See the demonstration program. Examples 100 X=LEN(A$) 2350 length=LEN(main$) Description This function returns the length of the string given as the argument.

Syntax = LEN ( ) Associated keywords LEFT$ , MID$ , RIGHT$ , INSTR Demonstration program 300 PRINT "Type in your word"; 310 INPUT A$ 320 Length=LEN(A$) 325 C$="" 330 FOR V=1 TO length 340 B$=MID$(A$,V,1) 350 C$=C$+CHR$(ASC(B$)+1) 360 NEXT V 370 PRINT "The coded version is ";C$ In the above program each letter is copied one at a time into . Then its ASCII