The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add String.is_empty

+17
+1
stdlib/string.ml
··· 304 304 305 305 let compare (x: t) (y: t) = Stdlib.compare x y 306 306 external equal : string -> string -> bool = "caml_string_equal" [@@noalloc] 307 + let is_empty s = Int.equal (length s) 0 307 308 308 309 (** {1 Iterators} *) 309 310
+5
stdlib/string.mli
··· 159 159 (** [compare s0 s1] sorts [s0] and [s1] in lexicographical order. [compare] 160 160 behaves like {!Stdlib.compare} on strings but may be more efficient. *) 161 161 162 + val is_empty : string -> bool 163 + (** [is_empty s] is [true] if and only if [s] is an empty string. 164 + 165 + @since 5.5 *) 166 + 162 167 val starts_with : 163 168 prefix (* comment thwarts tools/sync_stdlib_docs *) :string -> string -> bool 164 169 (** [starts_with ][~prefix s] is [true] if and only if [s] starts with
+5
stdlib/stringLabels.mli
··· 159 159 (** [compare s0 s1] sorts [s0] and [s1] in lexicographical order. [compare] 160 160 behaves like {!Stdlib.compare} on strings but may be more efficient. *) 161 161 162 + val is_empty : string -> bool 163 + (** [is_empty s] is [true] if and only if [s] is an empty string. 164 + 165 + @since 5.5 *) 166 + 162 167 val starts_with : 163 168 prefix (* comment thwarts tools/sync_stdlib_docs *) :string -> string -> bool 164 169 (** [starts_with ][~prefix s] is [true] if and only if [s] starts with
+6
testsuite/tests/lib-string/test_string.ml
··· 258 258 assert (String.of_char 'a' = "a"); 259 259 assert (String.of_char '\x00' = "\x00"); 260 260 () 261 + 262 + let () = 263 + (* Test String.is_empty *) 264 + assert (String.is_empty "life" = false); 265 + assert (String.is_empty "" = true); 266 + ()