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 17:15, 25 June 2020
, 4 years ago→{{header|Common Lisp}}
Line 586:
(funcall 127-operator (char-code ch) 127)))
string)))
(defvar *the-string* (coerce '(#\H #\e #\l #\l #\o #\Page #\W #\ø #\r #\l #\d) 'string))
(format t "Without controls: ~a~%" (strip-special-chars *the-string*))
(format t "Without extended characters: ~a~%" (strip-special-chars *the-string* :strip-extended t))
</pre>
Output:
<pre>
Without controls: HelloWørld
Without extended chars: HelloWrld
</pre>
|