Strip control codes and extended characters from a string: Difference between revisions

(→‎{{header|REXX}}: added the REXX language. -- ~~~~)
Line 744:
"abcd\xC3foo"
"abcdfoo"</pre>
 
 
=={{header|Run BASIC}}==
<lang runbasic>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</lang>
 
=={{header|Seed7}}==
Anonymous user