Anonymous user
Strip control codes and extended characters from a string: Difference between revisions
Strip control codes and extended characters from a string (view source)
Revision as of 22:04, 22 August 2011
, 12 years agono edit summary
m ({{omit from|Openscad}}) |
No edit summary |
||
Line 213:
[[Category:String manipulation]]
=={{header|Liberty BASIC}}==
<lang lb>
all$ =""
for i =0 to 255
all$ =all$ +chr$( i)
next i
print "Original string of bytes. ( chr$( 10) causes a CRLF.)"
print all$
print
lessControl$ =controlStripped$( all$)
print "With control codes stripped out."
print lessControl$
print
lessExtendedAndControl$ =extendedStripped$( lessControl$)
print "With extended codes stripped out too."
print lessExtendedAndControl$
end
function controlStripped$( i$)
r$ =""
for j =1 to len( i$)
ch$ =mid$( i$, j, 1)
if asc( ch$) >=32 then r$ =r$ +ch$
next j
controlStripped$ =r$
end function
function extendedStripped$( i$)
r$ =""
for j =1 to len( i$)
ch$ =mid$( i$, j, 1)
if asc( ch$) <=128 then r$ =r$ +ch$
next j
extendedStripped$ =r$
end function
</lang>
=={{header|Lua}}==
<lang lua>function Strip_Control_Codes( str )
|