diff options
Diffstat (limited to 'lib/jid.ml')
-rw-r--r-- | lib/jid.ml | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -24,6 +24,11 @@ let uchars_of_string s : uchars = loop (u :: acc) (i + k) in loop [] (String.length s) +let string_of_uchars (u : uchars) = + let buf = Buffer.create (4 * List.length u) in + List.iter (Buffer.add_utf_8_uchar buf) u; + Buffer.to_bytes buf |> String.of_bytes + let of_string (jid : string) : t = let open Uchar in let len = String.length jid in |