Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Substring/Nascom-BASIC/substring.basic
Normal file
31
Task/Substring/Nascom-BASIC/substring.basic
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
10 REM Substring
|
||||
20 BAS$="abcdefghijklmnopqrstuvwxyz"
|
||||
30 N=12:M=5
|
||||
40 REM Starting from N characters in
|
||||
50 REM and of M length
|
||||
60 SB$=MID$(BAS$,N,M)
|
||||
70 PRINT SB$
|
||||
80 REM Starting from N characters in,
|
||||
90 REM up to the end of the string
|
||||
100 SB$=MID$(BAS$,N,LEN(BAS$)-N+1)
|
||||
110 PRINT SB$
|
||||
120 REM Whole string minus last character
|
||||
130 SB$=LEFT$(BAS$,LEN(BAS$)-1)
|
||||
140 PRINT SB$
|
||||
150 REM Starting from a known character
|
||||
160 REM within the string and of M length
|
||||
170 A$=BAS$:B$="b":GOSUB 270
|
||||
180 SB$=MID$(BAS$,C,M)
|
||||
190 PRINT SB$
|
||||
200 REM Starting from a known substring
|
||||
210 REM within the string and of M length
|
||||
220 A$=BAS$:B$="pq":GOSUB 270
|
||||
230 SB$=MID$(BAS$,C,M)
|
||||
240 PRINT SB$
|
||||
250 END
|
||||
260 REM ** INSTR subroutine
|
||||
270 LB=LEN(B$):C=0
|
||||
280 FOR I=1 TO LEN(A$)-LB+1
|
||||
290 IF MID$(A$,I,LB)=B$ THEN C=I:RETURN
|
||||
300 NEXT I
|
||||
310 RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue