let rec chop x = let l = (String.length x) in if (l=0) then x else begin let last = (String.sub x (l-1) 1) in match last with | "\n" | " " | "\t" -> chop (String.sub x 0 (l-1)) | _ -> x end