Count occurrences of a substring: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 324:
180 NEXT I
190 RETURN</lang>
=={{header|IS-BASIC}}==
<lang IS-BASIC>100 INPUT PROMPT "String: ":TXT$
110 INPUT PROMPT "Substring: ":SUB$
120 PRINT COUNT(LCASE$(TXT$),LCASE$(SUB$))
130 DEF COUNT(TXT$,SUB$)
140 LET N=0:LET PO=1
150 DO
160 LET PO=POS(TXT$,SUB$,PO)
170 IF PO THEN LET N=N+1:LET PO=PO+LEN(SUB$)
180 LOOP UNTIL PO=0
190 LET COUNT=N
200 END DEF</lang>
==={{header|Sinclair ZX81 BASIC}}===
|