rescript-lang / rescript-core

A drop-in standard library for ReScript. Intended to be familiar for JavaScript developers, easy to use, and be rich enough (without being bloated) so that you don't need to reach for anything else for typical ReScript development.
MIT License
163 stars 30 forks source link

Add `String.getUnsafe` #208

Closed ryyppy closed 6 months ago

ryyppy commented 8 months ago

Needed to be able to migrate from OCaml's String.get(s, i) interface.

Basically this:

@get_index external getUnsafe: (string, int) => string = ""

Note that this is technically not the correct translation from its original function, which actually returns a char value.