Strip a set of characters from a string: Difference between revisions

Added S-BASIC example
(→‎K: add)
imported>KayproKid
(Added S-BASIC example)
Line 2,550:
Log:
<syntaxhighlight lang="sas">Sh ws soul strppr. Sh took my hrt!</syntaxhighlight>
 
=={{header|S-BASIC}}==
<syntaxhighlight lang="BASIC">
rem - strip unwanted characters from a string
function strip(s, unwanted = string) = string
var i, slen = integer
var outstr = string
var ch = char
slen = len(s)
outstr = ""
for i = 1 to slen
ch = mid(s, i, 1)
if instr(1, unwanted, ch) = 0 then
outstr = outstr + ch
next i
end = outstr
 
rem - exercise the routine
print strip("She was a soul stripper. She took my heart!","aei")
 
end
</syntaxhighlight>
{{out}}
<pre>
Sh ws soul strppr. Sh took my hrt!
</pre>
 
 
=={{header|Scala}}==
Anonymous user