(** Same as [index] but with no optional type, we return [0] when it does not occur *)
Definition findex n s1 s2 :=
match index n s1 s2 with
| Some n => n
| None => O
end.
(** *** Conversion to/from [list ascii] and [list byte] *)
Fixpoint string_of_list_ascii (s : list ascii) : string
:= match s with
| nil => EmptyString
| cons ch s => String ch (string_of_list_ascii s)
end.
Fixpoint list_ascii_of_string (s : string) : list ascii
:= match s with
| EmptyString => nil
| String ch s => cons ch (list_ascii_of_string s)
end.

(* Specifications: *)
Lemma string_of_list_ascii_of_string s : string_of_list_ascii (list_ascii_of_string s) = s.
Lemma list_byte_of_string_of_list_byte s : list_byte_of_string (string_of_list_byte s) = s.
Module Export StringSyntax.