let rec trim s =
  let l = String.length s in
  if l=0 then s 
  else if is_blank_char s.[0]   then trim (String.sub s 1 (l-1))
  else if is_blank_char s.[l-1] then trim (String.sub s 0 (l-1))
  else s