stringintegerocamldata-conversion

How do I convert int to string?


How do I convert an int to a string? Example: 1 to "1".


Solution

  • Use the function string_of_int (see the documentation for Pervasives, the module containing the functions that are automatically made available in the top level namespace to al OCaml programs).

    (As of June 11, 2024) In current OCaml, this is Stdlib.string_of_int