Strip comments from a string: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 477: | Line 477: | ||
<lang clojure>> (apply str (take-while #(not (#{\# \;} %)) "apples # comment")) |
<lang clojure>> (apply str (take-while #(not (#{\# \;} %)) "apples # comment")) |
||
"apples "</lang> |
"apples "</lang> |
||
=={{header|COBOL}}== |
|||
<lang cobol>> identification division. |
|||
program-id. StripComments. |
|||
data division. |
|||
working-storage section. |
|||
01 line-text pic x(64). |
|||
procedure division. |
|||
main. |
|||
move "apples, pears # and bananas" to line-text |
|||
perform show-striped-text |
|||
move "apples, pears ; and bananas" to line-text |
|||
perform show-striped-text |
|||
stop run |
|||
. |
|||
show-striped-text. |
|||
unstring line-text delimited by "#" into line-text |
|||
unstring line-text delimited by ";" into line-text |
|||
display quote, function trim(line-text), quote |
|||
.</lang> |
|||
{{out}} |
|||
<pre> |
|||
"apples, pears" "apples, pears" |
|||
</pre> |
|||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |