package mcp-kit
Source file fmt_uuid.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17(** Format validator: uuid. *) let is_hex = function | '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' -> true | _ -> false let check_uuid s = let len = String.length s in if len <> 36 then false else let ok = ref true in for i = 0 to len - 1 do let c = s.[i] in let valid = match i with 8 | 13 | 18 | 23 -> c = '-' | _ -> is_hex c in if not valid then ok := false done; !ok