Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
let strip_comments str =
|
||||
let len = String.length str in
|
||||
let rec aux print i =
|
||||
if i >= len then () else
|
||||
match str.[i] with
|
||||
| '#' | ';' ->
|
||||
aux false (succ i)
|
||||
| '\n' ->
|
||||
print_char '\n';
|
||||
aux true (succ i)
|
||||
| c ->
|
||||
if print then print_char c;
|
||||
aux print (succ i)
|
||||
in
|
||||
aux true 0
|
||||
|
||||
let () =
|
||||
strip_comments "apples, pears # and bananas\n";
|
||||
strip_comments "apples, pears ; and bananas\n";
|
||||
;;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
let strip_comments =
|
||||
let print = ref true in
|
||||
String.iter (function
|
||||
| ';' | '#' -> print := false
|
||||
| '\n' -> print_char '\n'; print := true
|
||||
| c -> if !print then print_char c)
|
||||
Loading…
Add table
Add a link
Reference in a new issue