home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 76 / 076.d81 / forum (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  307b  |  11 lines

  1. 10 dima$(40):input"enter a string";a$:gosub1000
  2. 20 w$="":input "which word (_ for another string)";w$:w=val(w$)
  3. 25 ifw$="_"thenrun
  4. 30 printa$(w):goto20
  5. 1000 s$=chr$(0):fori=1tolen(a$)
  6. 1010 ifmid$(a$,i,1)=" "ormid$(a$,i,1)="[160]"thens$=s$+chr$(i)
  7. 1020 next:s$=s$+chr$(len(a$)+1)
  8. 1025 forw=1tolen(s$)-1
  9. 1030 a$(w)=mid$(a$,asc(mid$(s$,w,1))+1,asc(mid$(s$,w+1,1))-asc(mid$(s$,w,1))-1)
  10. 1040 next:return
  11.