123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687open!ImportincludeBase.String(* These two are needed because [include Identifiable.Extend] (present later in the file)
binds new [Map] and [Set] modules. *)moduleCore_map=MapmoduleCore_set=SetmoduleStable=structmoduleV1=structmoduleT=structincludeBase.Stringtypet=string[@@derivingbin_io]endincludeTletto_string=Fn.idletof_string=Fn.idincludeComparable.Stable.V1.Make(T)includeHashable.Stable.V1.Make(T)endendmoduleCaseless=structmoduleT=structincludeCaselesstypet=string[@@derivingbin_io]endincludeTincludeComparable.Make_binable_using_comparator(T)includeHashable.Make_binable(T)endtypet=string[@@derivingtyperep]includeIdentifiable.Extend(Base.String)(structtypet=string[@@derivingbin_io]end)includeHexdump.Of_indexable(structtypet=stringletlength=lengthletget=getend)letquickcheck_generator=Base_quickcheck.Generator.stringletquickcheck_observer=Base_quickcheck.Observer.stringletquickcheck_shrinker=Base_quickcheck.Shrinker.stringletgen_nonempty=Base_quickcheck.Generator.string_non_emptyletgen'=Base_quickcheck.Generator.string_ofletgen_nonempty'=Base_quickcheck.Generator.string_non_empty_ofletgen_with_lengthlengthchars=Base_quickcheck.Generator.string_with_length_ofchars~length;;lettake_whilet~f=matchlfindit~f:(fun_elt->not(felt))with|None->t|Somei->subt~pos:0~len:i;;letrtake_whilet~f=matchrfindit~f:(fun_elt->not(felt))with|None->t|Somei->subt~pos:(i+1)~len:(lengtht-i-1);;(** See {!Array.normalize} for the following 4 functions. *)letnormalizeti=Ordered_collection_common.normalize~length_fun:lengthtiletslicetstartstop=Ordered_collection_common.slice~length_fun:length~sub_fun:subtstartstop;;letngetxi=letmoduleString=Base.Stringinx.[normalizexi];;