79562995

Date: 2025-04-08 20:32:35
Score: 1
Natty:
Report link

The Uutf library has a fold_utf_8 function, so I've created this function:

let str_chars : string -> Uchar.t list =
  Uutf.String.fold_utf_8 (fun acc _ c ->
    match c with
    | `Uchar u -> u::acc
    | `Malformed _ -> failwith ""
  ) []

I still find it crazy that something so simple can be so difficult to find information on. I've lost some of my sanity trying to find the answer, so I'm posting this here so that hopefully nobody has to go through this again.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user8203231