1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192open!ImportincludeBase.String(* These two are needed because [include Identifiable.Extend] (present later in the file)
binds new [Map] and [Set] modules. *)moduleStable=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(structincludeBase.Stringlethashable=Stable.V1.hashableend)(structtypet=string[@@derivingbin_io]end)includeComparable.Validate(Base.String)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];;