18 lines
612 B
Plaintext
18 lines
612 B
Plaintext
function strip_comments(string s, sequence comments={"#",";"})
|
|
for i=1 to length(comments) do
|
|
integer k = match(comments[i],s)
|
|
if k then
|
|
s = s[1..k-1]
|
|
s = trim_tail(s)
|
|
end if
|
|
end for
|
|
return s
|
|
end function
|
|
|
|
?strip_comments("apples, pears # and bananas")
|
|
?strip_comments("apples, pears ; and bananas")
|
|
?strip_comments("apples, pears and bananas ")
|
|
?strip_comments(" WS_CAPTION = #00C00000, -- = WS_BORDER+WS_DLGFRAME")
|
|
?strip_comments(" WS_CAPTION = #00C00000, -- = WS_BORDER+WS_DLGFRAME",{"--"})
|
|
?strip_comments(" title = \"--Title--\"",{"--"})
|