Strip a set of characters from a string: Difference between revisions
Content deleted Content added
→{{header|AutoHotkey}}: AutoHotkey example added |
|||
Line 674:
String.translate aux string
end</lang>
testing in the interpreter:
<pre>- stripchars ("She was a soul stripper. She took my heart!", "aei") ;
val it = "Sh ws soul strppr. Sh took my hrt!" : string</pre>
Alternately:
<lang sml>fun stripchars (string, chars) =
String.concat (String.tokens (fn c => String.isSubstring (str c) chars) string)
</lang>
testing in the interpreter:
|