Substring/Top and tail: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(Substring/Top and tail in various BASIC dialents (BASIC256, Qbasic, True BASIC, XBasic and Yabasic))
Line 367: Line 367:
9010 DEF FN L$(A$)=LEFT$(A$,LEN(A$)-1)
9010 DEF FN L$(A$)=LEFT$(A$,LEN(A$)-1)
9020 DEF FN B$(A$)=FN L$(FN F$(A$))</syntaxhighlight>
9020 DEF FN B$(A$)=FN L$(FN F$(A$))</syntaxhighlight>

==={{header|QBasic}}===
{{works with|QBasic|1.1}}
{{works with|QuickBasic|4.5}}
<syntaxhighlight lang="qbasic">s$ = "Rosetta Code"

PRINT s$
PRINT MID$(s$, 2) 'strip first
PRINT LEFT$(s$, LEN(s$) - 1) 'strip last
PRINT MID$(s$, 2, LEN(s$) - 2) 'strip first and last</syntaxhighlight>

==={{header|BASIC256}}===
<syntaxhighlight lang="freebasic">s$ = "Rosetta Code"

print s$
PRINT MID$(s$, 2) 'strip first
PRINT LEFT$(s$, LEN(s$) - 1) 'strip last
PRINT MID$(s$, 2, LEN(s$) - 2) 'strip first and last</syntaxhighlight>

==={{header|True BASIC}}===
<syntaxhighlight lang="qbasic">LET s$ = "Rosetta Code"
PRINT s$
PRINT (s$)[2:maxnum] !strip first
PRINT (s$)[1:len(s$)-1] !strip last
PRINT (s$)[2:2+len(s$)-2-1] !strip first and last
END</syntaxhighlight>

==={{header|XBasic}}===
{{works with|Windows XBasic}}
<syntaxhighlight lang="xbasic">PROGRAM "Substring"
VERSION "0.0000"

DECLARE FUNCTION Entry ()

FUNCTION Entry ()
s$ = "Rosetta Code"

PRINT s$
PRINT MID$(s$, 2) 'strip first
PRINT LEFT$(s$, LEN(s$) - 1) 'strip last
PRINT MID$(s$, 2, LEN(s$) - 2) 'strip first and last

END FUNCTION
END PROGRAM</syntaxhighlight>

==={{header|Yabasic}}===
<syntaxhighlight lang="freebasic">s$ = "Rosetta Code"

print s$
PRINT MID$(s$, 2) 'strip first
PRINT LEFT$(s$, LEN(s$) - 1) 'strip last
PRINT MID$(s$, 2, LEN(s$) - 2) 'strip first and last</syntaxhighlight>


==={{header|IS-BASIC}}===
==={{header|IS-BASIC}}===