| (RWJՠ55.5.0+dev0-2025-04-28/,StringLabels!tA;@@@A&string@@@@@@@=../../stdlib/stringLabels.mliK  K  "@@@@,StringLabels@@A@$make@#int@@@@$char@@@!@@@@@@@@ N A A!N A a@@A@@$init@@@@!f@)@@@&@@@@@F@@@@@@@@ET  FT 4@@DB@@%emptyT@@@@S[T[#@@RC@@&length@d@@@V@@@@@.%string_lengthAA @@@maOOnaO@@lD@@#get@~@@@@r@@@o@@@@@@@0%string_safe_getBA!@@@@dd@@E@@(of_bytes@%bytes@@@@@@@@@jj@@F@@(to_bytes@@@@@@@@@@q%%q%C@@G@@$blit#src@@@'src_pos@@@#dst?@@@'dst_pos@@@#len@@@$unit@@@@@@@@@@@@@@xy@@H@@&concat#sep@@@@$listϠ@@@@@@@@@@@@@@@@I@@#cat@+@@@@2@@@7@@@@@@@@67@@5J@@%equal@,StringLabels!t@@@@,StringLabels!t@@@$bool@@@@@@@@YZ@@XK@@'compare@,StringLabels!t@@@@,StringLabels!t@@@i@@@@@@@@{@@|@[@@zL@@+starts_with&prefix@@@@@@@A@@@@@@@@V@@M@@)ends_with &suffix@@@@@@@_@@@@@@@@ @@N@@-contains_from!@@@@@@@@@@@@@@@@@@@@@@@@O@@.rcontains_from"@@@@@@@@@@@@@@@@@@@@@@ggg@@P@@(contains#@@@@@@@@@@@@@@@@aaa@@Q@@#sub$@*@@@#pos @@@#len)@@@A@@@@@@@@@@@A@@?R@@-split_on_char%#sep8@@@@Z@@@Pd@@@ @@@ @@ @@ @deD@@cS@@#map&!f@^@@@c@@@@@@@@@@@@@@@@@@@T@@$mapi'!f@@@@@@@@@@@@@@@@@@@@@@@@@@@<<<r@@U@@)fold_left(!f@#acc@'B@@@@@ @@ @@!$init@@@@"@@#@@$@@%@(@@V@@*fold_right)!f@@@@(@#acc@1B@)@@*@@+@@@@,$init@@-@@.@@/@ @@W@@'for_all*!f@@@@2@@@3@@4@$@@@5@@@6@@7@@8@(  )  @@'X@@&exists+!f@"@@@9@@@:@@;@I@@@<@@@=@@>@@?@M!$!$N!$!S@@LY@@$trim,@^@@@@c @@@A@@B@b!!c!!@@aZ@@'escaped-@s @@@Cx @@@D@@E@w""x""@@v[@@/uppercase_ascii.@ @@@F @@@G@@H@$$$$@@\@@/lowercase_ascii/@@@@I@@@J@@K@ %n%n %n%@@]@@0capitalize_ascii0@@@@L@@@M@@N@&#&#&#&J@@^@@2uncapitalize_ascii1@@@@O@@@P@@Q@&&&&@@_@@$iter2!f@@@@R@@@S@@T@@@@U@@@V@@W@@X@!''!''@@`@@%iteri3!f@@@@Y@@@@Z@@@[@@\@@]@@@@^(@@@_@@`@@a@%(k(k%(k(@@a@@*index_from4@-@@@b@!@@@c@ @@@d- @@@e@@f@@g@@h@?-)9)9@-)9)f@@>b@@.index_from_opt5@P!@@@i@D"@@@j@C#@@@k&optionLV$@@@l@@@n@@o@@p@@q@i5*X*Xj5*X*@@hc@@+rindex_from6@z%@@@r@n&@@@s@m'@@@tz(@@@u@@v@@w@@x@<+X+X<+X+@@d@@/rindex_from_opt7@)@@@y@*@@@z@+@@@{M,@@@|@@@~@@@@@@@C,,C,,@@e@@%index8@-@@@@.@@@/@@@@@@@@J--J--@@f@@)index_opt9@0@@@@1@@@2@@@@@@@@@@@M--M-.@@g@@&rindex:@3@@@@4@@@5@@@@@@@@ R.W.WR.W.y@@ h@@*rindex_opt;@6@@@@ 7@@@Ǡ8@@@@@@@@@@@.U../U..@@-i@@&to_seq{@,StringLabels9!t@@@&Stdlib;#Seq!t6:@@@ @@@ @@ @Q\/k/kR\/k/@@Pj@@'to_seqi|@,StringLabels@@@ @@ @@@ @@ @b//b/0@@~k@@&of_seq}@&StdlibA#Seq!t@@@@ @@@ ,StringLabelsB!t@@@ @@ @g0y0yg0y0@@l@@/get_utf_8_uchar@,StringLabelsC!t@@@ @D@@@ &StdlibE%Uchar*utf_decode@@@ r@@ s@@ t@r1?1?r1?1q@@m@@.is_valid_utf_8@,StringLabelsF!t@@@ uG@@@ v@@ w@v11v11@@n@@2get_utf_16be_uchar@,StringLabelsH!t@@@ x@I@@@ y&StdlibJ%Uchar*utf_decode@@@ z@@ {@@ |@|2X2X|2X2@@o@@1is_valid_utf_16be@,StringLabelsK!t@@@ }L@@@ ~@@ @2223@@p@@2get_utf_16le_uchar@,StringLabelsM!t@@@ @"N@@@ &StdlibO%Uchar*utf_decode@@@ @@ @@ @>33?33@@=q@@1is_valid_utf_16le@,StringLabelsP!t@@@ Q@@@ @@ @V44W442@@Ur@@-edit_distance%limitZR@@@ @@@ @,StringLabelsS!t@@@ @,StringLabelsT!t@@@ tU@@@ @@ @@ @@ @4444@@s@@*spellcheck(max_dist0@V@@@ W@@@ @@ @@@ @@@X@@@ Y@@@ @@ Z@@@ @@ @[@@@ ]\@@@ @@@ @@ @@ @@ @8o8o88@@t@@)get_uint8@^@@@ @_@@@ `@@@ @@ @@ @?$?$?$?H@@u@@(get_int8@a@@@ @b@@@ c@@@ @@ @@ @????@@v@@-get_uint16_ne@d@@@ @e@@@  f@@@ @@ @@ @@F@F@F@n@@w@@-get_uint16_be@/g@@@ @#h@@@ (i@@@ @@ @@ @:@@;@A@@9x@@-get_uint16_le@Kj@@@ @?k@@@ Dl@@@ @@ @@ @VAAWAA@@Uy@@,get_int16_ne@gm@@@ @[n@@@ `o@@@ @@ @@ @rBABAsBABh@@qz@@,get_int16_be@p@@@ @wq@@@ |r@@@ @@ @@ @BBBC@@{@@,get_int16_le@s@@@ @t@@@ u@@@ @@ @@ @CCCC@@|@@,get_int32_ne@v@@@ @w@@@ %int32x@@@ @@ @@ @ D0D0 D0DY@@}@@$hash@,StringLabelsy!t@@@ z@@@ @@ @DDDD@@~@@+seeded_hash@{@@@ @,StringLabels|!t@@@ }@@@ @@ @@ @EEEE@@@@,get_int32_be@~@@@ @@@@ T@@@ @@ @@ @ FF FF@@@@@,get_int32_le@+@@@ @@@@ p@@@ @@ @@ @6'GOGO7'GOGx@@5A@@,get_int64_ne@G@@@ @;@@@ %int64@@@ @@ @@ @S.GGT.GH@@RB@@,get_int64_be@d@@@ @X@@@ @@@ @@ @@ @o5HHp5HH@@nC@@,get_int64_le@@@@ @t@@@ 9@@@ @@ @@ @<I/I/<I/IX@@D@@*unsafe_get@@@@ @@@@ @@@ @@ @@ 2%string_unsafe_getBA?@@@@GJJGJJ^@@E@@+unsafe_blit#src@@@ 'src_pos@@@ #dst2@@@ 'dst_pos@@@ #len@@@ @@@ @@ @@ @@ @@ @@ 0caml_blit_stringE@@@@@@@@HJ_J_JJJ@'noallocJJJJJJ@@JJJ @@F@@@3(Strings.@. A string !s+ of length !n / is an indexable and immutable sequence of !n M bytes. For historical reasons these bytes are referred to as characters.@ The semantics of string functions is defined in terms of indices and positions. These are depicted and described as follows.@! positions 0 1 2 3 4 n-1 n +---+---+---+---+ +-----+ indices | 0 | 1 | 2 | 3 | ... | n-1 | +---+---+---+---+ +-----+% #An %index@! !i$ of !s= is an integer in the range [!0!;#n-1<]. It represents the !i7th byte (character) of !s V which can be accessed using the constant time string indexing operator %s.[i]!.@"A (position@! !i$ of !s $ is an integer in the range [!0!;!n ]. It represents either the point at the beginning of the string, or the point between two indices, or the point at the end of the string. The !i )th byte index is between position !i% and #i+1!.@@@2 Two integers %start% and #len6 are said to define a 3valid substring@$ of !s$ if (len >= 0% and %start", )start+len6 are positions of !s!.@% -Unicode text.@  Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string +"\u{1F42B}" < is the UTF-8 encoding of the Unicode character U+1F42B.@% 0Past mutability.@ D Before OCaml 4.02, strings used to be modifiable in place like 'Bytes.t@@ mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.@ L The labeled version of this module can be used as described in the )StdLabels@@( module.@@@@@@@@@@@@A=../../stdlib/stringLabels.mliA'strings'Strings@@#.StringLabels.t35The type for strings.@@@@@@@@@@@@@@A @  @@1StringLabels.make3(make n c7 is a string of length !n + with each index holding the character !c!.@@@@@@@@0Invalid_argument#if %n < 0$ or $n > 5Sys.max_string_length@@!.@@@@@ 6@  8@ 3@@@@ *1StringLabels.init3)init n ~f7 is a string of length !n0 with index !i7 holding the character #f i $ (called in increasing index order).@@@@$4.02@@@0Invalid_argument#if %n < 0$ or $n > 5Sys.max_string_length@@!.@@@@@ W@? X@ S R@@@@ C2StringLabels.empty31The empty string.@@@@$4.13@@@@@@@ F@@@@ C3StringLabels.length3(length s / is the length (number of bytes/characters) of !s!.@@@@@@@@@@@@ M@h N@@@@ A0StringLabels.get3'get s i; is the character at index !i$ in !s ". This is the same as writing %s.[i]!.@@@@@@@@0Invalid_argument#if !i1 not an index of !s!.@@@@@ i@ j@ f@@@@ Y5StringLabels.of_bytes3 PReturn a new string that contains the same bytes as the given byte sequence.@@@@$4.13@@@@@@@ \@ ]@@@@ T5StringLabels.to_bytes3 PReturn a new byte sequence that contains the same bytes as the given string.@@@@$4.13@@@@@@@ W@ X@@@@ P1StringLabels.blit3(Same as 1Bytes.blit_string@@; which should be preferred.@@@@@@@@@@@@ W@ W V@ Q P@ K J@ E D@ ? >@@@@ 5A&concat-Concatenating@@% %Note.@% The ,Stdlib.( ^ )@@ . binary operator concatenates two strings.@3StringLabels.concat3.concat ~sep ss " concatenates the list of strings "ss %, inserting the separator string #sep. between each.@@@@@@@@0Invalid_argument !if the result is longer than 5Sys.max_string_length@@' bytes.@@@@@ l@ l k@, g@@@@ X0StringLabels.cat3)cat s1 s29 concatenates s1 and s2 ('s1 ^ s2").@@@@$4.13@@@0Invalid_argument !if the result is longer than 5Sys.max_string_length@@' bytes.@@@@@ p@R q@U m@@@@ eA*predicates:Predicates and comparisons@@2StringLabels.equal3+equal s0 s1$ is $true0 if and only if "s0% and "s1> are character-wise equal.@@@@$4.05@@@@@@@ @ @ @@@@ t4StringLabels.compare3-compare s0 s1' sorts "s0% and "s1; in lexicographical order. 'compare2 behaves like .Stdlib.compare@@ & on strings but may be more efficient.@@@@@@@@@@@@ @ @ @@@@ 8StringLabels.starts_with3,starts_with )~prefix s$ is $true0 if and only if !s1 starts with &prefix!.@@@@$4.13@@@@@@@ @  @ @@@@ 6StringLabels.ends_with3*ends_with )~suffix s$ is $true0 if and only if !s+ ends with &suffix!.@@@@$4.13@@@@@@@ @  @  @@@@ :StringLabels.contains_from37contains_from s start c$ is $true0 if and only if !c, appears in !s4 after position %start!.@@@@@@@@0Invalid_argument#if %start< is not a valid position in !s!.@@@@@ @H @K @N @@@@ ;StringLabels.rcontains_from37rcontains_from s stop c$ is $true0 if and only if !c, appears in !s5 before position &stop+1!.@@@@@@@@0Invalid_argument#if (stop < 0$ or &stop+1 is not a valid position in !s!.@@@@@ @ @ @ @@@@ ߠ5StringLabels.contains3,contains s c$ is 4String.contains_from@@& s 0 c!.@@@@@@@@@@@@ @ @ @@@@ ᠙A'extract5Extracting substrings@@0StringLabels.sub3/sub s ~pos ~len7 is a string of length #len ", containing the substring of !s9 that starts at position #pos4 and has length #len!.@@@@@@@@0Invalid_argument#if #pos% and #len + do not designate a valid substring of !s!.@@@@@ @ @  @  @@@@ :StringLabels.split_on_char34split_on_char ~sep s 7 is the list of all (possibly empty) substrings of !s % that are delimited by the character #sep). If !s , is empty, the result is the singleton list $[""]!.@ I The function's result is specified by the following invariants: 6The list is not empty.@ !Concatenating its elements using #sep ; as a separator returns a string equal to the input ( 3concat (make 1 sep) (split_on_char sep s) = s").@ %No string in the result contains the #sep+ character.@@@@@@$4.05@@@@@@@ M@ M L@X H@@@@ :A,transforming,Transforming@@0StringLabels.map3'map f s ' is the string resulting from applying !f> to all the characters of !s5 in increasing order.@@@@$4.00@@@@@@@ U@ U T@ I@@@@ A1StringLabels.mapi3)mapi ~f s) is like /D@ 6 but the index of the character is also passed to !f!.@@@@$4.02@@@@@@@ S@ S R@ @@@@@ 86StringLabels.fold_left3/fold_left f x s* computes )f (... (f (f x s.[0]) s.[1]) ...) s.[n-1],, where !n= is the length of the string !s!.@@@@$4.13@@@@@@@ P@ P O@ @ P@ @@@@@ =7StringLabels.fold_right30fold_right f s x* computes *f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)),, where !n= is the length of the string !s!.@@@@$4.13@@@@@@@ U@ U T@ F@ A Q@@@@ B4StringLabels.for_all3+for_all p s= checks if all characters in !s7 satisfy the predicate !p!.@@@@$4.13@@@@@@@ T@ T S@" H@@@@ @3StringLabels.exists3*exists p s % checks if at least one character of !s= satisfies the predicate !p!.@@@@$4.13@@@@@@@ R@ R Q@E F@@@@ >1StringLabels.trim3&trim s$ is !s I without leading and trailing whitespace. Whitespace characters are: #' '", &'\x0C'. (form feed), $'\n'", $'\r'&, and $'\t'!.@@@@$4.00@@@@@@@ h@} i@@@@ a4StringLabels.escaped3)escaped s$ is !s i with special characters represented by escape sequences, following the lexical conventions of OCaml.@ All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).@2 The function /Scanf.unescaped@@6 is a left inverse of 'escaped+, i.e. ?Scanf.unescaped (escaped s) = s0 for any string !s- (unless )escaped s( fails).@@@@@@@@0Invalid_argument !if the result is longer than 5Sys.max_string_length@@' bytes.@@@@@ @ @@@@ 7StringLabels.rindex_opt3.rindex_opt s c$ is 6String.rindex_from_opt@@3 s (length s - 1) c!.@@@@$4.05@@@@@@@ M@" N@% J@@@@ =A@5Strings and Sequences@@3StringLabels.to_seq3(to_seq s G is a sequence made of the string's characters in increasing order.@@@@$4.07@@@@@@@ J@@ K@@@@ 54StringLabels.to_seqi3)to_seqi s) is like  D@ ) but also tuples the corresponding index.@@@@$4.07@@@@@@@ A@Z B@@@@ !3StringLabels.of_seq3(of_seq s / is a string made of the sequence's characters.@@@@$4.07@@@@@@@ '@n (@@@@ A#utfStringLabels.is_valid_utf_16be33is_valid_utf_16be b$ is $true0 if and only if !b " contains valid UTF-16BE data.@@@@@@@@@@@@ =@ >@@@@ 3B(utf_16le(UTF-16LE@@?StringLabels.get_utf_16le_uchar36get_utf_16le_uchar b i , decodes an UTF-16LE character at index !i$ in !b!.@@@@@@@@@@@@ L@. M@1 F@@@@ 9>StringLabels.is_valid_utf_16le33is_valid_utf_16le b$ is $true0 if and only if !b " contains valid UTF-16LE data.@@@@@@@@@@@@ I@O J@@@@ ?A-spellchecking-Spellchecking@@:StringLabels.edit_distance33edit_distance s0 s1 is the number of single character edits (understood as insertion, deletion, substitution, transposition) that are needed to change "s0& into "s1!.@( If %limit ' is provided the function returns with %limit ' as soon as it was determined that "s0% and "s1? have distance of at least %limit N. This is faster if you have a fixed limit, for example for spellchecking.@ A The function assumes the strings are UTF-8 encoded and uses 'Uchar.t@@ F for the notion of character. Decoding errors are replaced by )Uchar.rep@@ !. Normalizing the strings to 2https://unicode.org/glossary/#normalization_form_c#NFC@: gives better results.@% %Note.@ This implements the simpler Optimal String Alignement (OSA) distance, not the Damerau-Levenshtein distance. With this function $"ca"% and %"abc"< have a distance of 3 not 2.@@@@#5.4@@@@@@@ @  @ @ @@@@ 7StringLabels.spellcheck36spellcheck iter_dict s 0 are the strings enumerated by the iterator )iter_dict' whose D-edit distance@$ to !s ! is the smallest and at most *max_dist s F. If multiple corrections are returned their order is as found in )iter_dict2. The default *max_dist s$ is:@% !0$ if !s? has 0 to 2 Unicode characters.@!1$ if !s? has 3 to 4 Unicode characters.@!2+ otherwise.@@@ " If your dictionary is a list !l-, a suitable )iter_dict1 is given by (fun yield -> List.iter yield l)!.@ V All strings are assumed to be UTF-8 encoded, decoding errors are replaced by )Uchar.rep@@, characters.@@@@#5.4@@@@@@@ @  @ W @ Z @@@@ ֠A@;Binary decoding of integers@@ BThe functions in this section binary decode integers from strings.@ # All following functions raise 0Invalid_argument ' if the characters needed at index !i ) to decode the integer are not available.@ Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on .Sys.big_endian@@!.@ 7 32-bit and 64-bit integers are represented by the %int32) and %int64 J types, which can be interpreted either as signed or unsigned numbers.@ 6 8-bit and 16-bit integers are represented by the #int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with #int( values.@6StringLabels.get_uint83-get_uint8 b i$ is !b :'s unsigned 8-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ .@  /@  +@@@@ #5StringLabels.get_int83,get_int8 b i$ is !b 8's signed 8-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ 5@  6@  2@@@@ *:StringLabels.get_uint16_ne31get_uint16_ne b i$ is !b I's native-endian unsigned 16-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ <@  =@  9@@@@ 1:StringLabels.get_uint16_be31get_uint16_be b i$ is !b F's big-endian unsigned 16-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ C@ ) D@ , @@@@@ 8:StringLabels.get_uint16_le31get_uint16_le b i$ is !b I's little-endian unsigned 16-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ J@ L K@ O G@@@@ ?9StringLabels.get_int16_ne30get_int16_ne b i$ is !b G's native-endian signed 16-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ Q@ o R@ r N@@@@ F9StringLabels.get_int16_be30get_int16_be b i$ is !b D's big-endian signed 16-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ X@  Y@  U@@@@ M9StringLabels.get_int16_le30get_int16_le b i$ is !b G's little-endian signed 16-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ _@  `@  \@@@@ T9StringLabels.get_int32_ne30get_int32_ne b i$ is !b @'s native-endian 32-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ f@  g@  c@@@@ Z1StringLabels.hash3 IAn unseeded hash function for strings, with the same output value as ,Hashtbl.hash@@ O. This function allows this module to be passed as argument to the functor ,Hashtbl.Make@@!.@@@@#5.0@@@@@@@ i@  j@@@@ _8StringLabels.seeded_hash3 FA seeded hash function for strings, with the same output value as 3Hashtbl.seeded_hash@@ O. This function allows this module to be passed as argument to the functor 2Hashtbl.MakeSeeded@@!.@@@@#5.0@@@@@@@ n@  o@  k@@@@ `9StringLabels.get_int32_be30get_int32_be b i$ is !b ='s big-endian 32-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ r@ 8 s@ ; o@@@@ g9StringLabels.get_int32_le30get_int32_le b i$ is !b @'s little-endian 32-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ y@ [ z@ ^ v@@@@ n9StringLabels.get_int64_ne30get_int64_ne b i$ is !b @'s native-endian 64-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ @ ~ @  }@@@@ t9StringLabels.get_int64_be30get_int64_be b i$ is !b ='s big-endian 64-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ @  @  @@@@ {9StringLabels.get_int64_le30get_int64_le b i$ is !b @'s little-endian 64-bit integer starting at character index !i!.@@@@$4.13@@@@@@@ @  @  @@@@ @@ @@A%Uchar#Seq@@@@@