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

added langur language example
(a more straightforward method, along with the previous entry.)
(added langur language example)
Line 1,147:
String = 123abcDEF+-*/ Length = 13
</pre>
 
=={{header|langur}}==
<lang langur>val .str = "()\x15abcd\uFFEF123!@#$%^&*"
 
writeln "original : ", .str
writeln "without ctrl chars: ", replace(.str, RE/\p{Cc}/, ZLS)
writeln "print ASCII only : ", replace(.str, re/[^ -~]/, ZLS)</lang>
 
{{out}}
<pre>original : ()�abcd￯123!@#$%^&*
without ctrl chars: ()abcd￯123!@#$%^&*
print ASCII only : ()abcd123!@#$%^&*</pre>
 
=={{header|Liberty BASIC}}==
890

edits