RosettaCodeData/Task/Strip-comments-from-a-string/Zkl/strip-comments-from-a-string-1.zkl

9 lines
301 B
Text
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
fcn strip(text,c){ // if c in text, remove it and following text
if (Void!=(n:=text.find(c))) text=text[0,n];
text.strip() // remove leading and trailing white space
}
fcn stripper(text,a,b,c,etc){ // strip a,b,c,etc from text
foreach c in (vm.arglist[1,*]){ text=strip(text,c) }
text
}