Anonymous user
Strip a set of characters from a string: Difference between revisions
Strip a set of characters from a string (view source)
Revision as of 12:37, 6 June 2011
, 13 years ago→Tcl: Added implementation
m (tidy) |
(→Tcl: Added implementation) |
||
Line 64:
>>> stripchars("She was a soul stripper. She took my heart!", "aei")
'Sh ws soul strppr. Sh took my hrt!'</lang>
=={{header|Tcl}}==
<lang tcl>proc stripchars {str chars} {
foreach c [split $chars ""] {set str [string map [list $c ""] $str]}
return $str
}
set s "She was a soul stripper. She took my heart!"
puts [stripchars $s "aei"]</lang>
|