RosettaCodeData/Task/Strip-control-codes-and-extended-characters-from-a-string/Run-BASIC/strip-control-codes-and-extended-characters-from-a-string.basic
2023-07-01 13:44:08 -04:00

21 lines
459 B
Text

s$ = chr$(31) + "abc" + chr$(13) + "def" + chr$(11) + "ghi" + chr$(10)
print strip$(s$)
' -----------------------------------------
' strip junk
' -----------------------------------------
FUNCTION strip$(str$)
for i = 1 to len(str$)
a$ = MID$(str$,i,1)
a = ASC(a$)
if a > 31 then
if a < 123 then
if a$ <> "'" then
if a$ <> """" then
strip$ = strip$ + a$
end if
end if
end if
end if
next i
END FUNCTION