Building a Word Splitter on the C64 in Commodore BASIC
In this video I'm demonstrating how to build a word splitter on the Commodore 64. We'll use string functions to parse a sentence and split each word off into an array of words so that they can be analysed later (for example, as part of an adventure game).
Here's the code I'm building:
20 input a$
30 gosub 100
40 print:print wd;" words:"
50 for i=1 to wd
60 print wd$(i)
70 next
99 end
100 rem word splitter
110 lt$="":wd=1
120 for i=1 to len(a$)
130 lt$=mid$(a$,i,1)
140 if lt$=" " then wd=wd+1:next
150 wd$(wd)=wd$(wd)+lt$
160 next
199 return
Apologies for the audio quality, I did this on my laptop while sitting on the balcony, hence sea planes flying overhead can be heard (as well as the neighbours dog and kids).
SUPPORT MY PROJECTS
=====================
https://patreon.com/versluis
https://streamlabs.com/wpguru
LISTEN ON SPOTIFY
=================
3D Podcast
https://open.spotify.com/show/4IIh2WPBMRbjct6wdrGcTH?si=Tb7qVvEeQ2GxHpVjahGZNQ
Tech Podcast
https://open.spotify.com/show/3MSMNOruDorce08roxUy85?si=63KfmlDFTT-U1HzpNaa8pw