Tokenize a string: Difference between revisions

Added Chipmunk Basic and MSX Basic
(add RPL)
(Added Chipmunk Basic and MSX Basic)
Line 1,003:
NEXT
PRINT</syntaxhighlight>
 
==={{header|Chipmunk Basic}}===
Solutions [[#Applesoft BASIC|Applesoft BASIC]] and [[#Commodore BASIC|Commodore BASIC]] work without changes.
 
==={{header|Commodore BASIC}}===
Based on the AppleSoft BASIC version.
<syntaxhighlight lang="commodorebasic">10 REM TOKENIZE A STRING ... ROSETTACODE.ORG
10 REM TOKENIZE A STRING ... ROSETTACODE.ORG
20 T$ = "HELLO,HOW,ARE,YOU,TODAY"
30 GOSUB 200, TOKENIZE
Line 1,023 ⟶ 1,025:
260 N = N + 1
270 NEXT L
280 RETURN</syntaxhighlight>
 
</syntaxhighlight>
==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">sub tokenize( instring as string, tokens() as string, sep as string )
Line 1,058 ⟶ 1,060:
Print Left$(array$, (Len(array$) - 1))</syntaxhighlight>
 
==={{header|PowerBASICMSX Basic}}===
The [[#Commodore BASIC|Commodore BASIC]] solution works without any changes.
 
==={{header|PowerBASIC}}===
PowerBASIC has a few keywords that make parsing strings trivial: <code>PARSE</code>, <code>PARSE$</code>, and <code>PARSECOUNT</code>. (<code>PARSE$</code>, not shown here, is for extracting tokens one at a time, while <code>PARSE</code> extracts all tokens at once into an array. <code>PARSECOUNT</code> returns the number of tokens found.)
 
2,122

edits