OCaml - How do I convert int to string?

EBM picture EBM · Apr 3, 2012 · Viewed 43.9k times · Source

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

Answer

Michael Ekstrand picture Michael Ekstrand · Apr 3, 2012

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).