Mateus Felipe
Mateus Felipe

Reputation: 1171

ReasonML equivalent of OCaml ExtString.exists

ReasonML is built upon OCaml, and much of OCaml stdlib is available on ReasonML. However, ExtString is not one of them.

I'm in need of using ExtString.exists to verify if a substring sub exists within a string str. I know that I can make my own function, as explained here, but I'm wondering if there's any way I can import ExtString from or OCaml, or if there's a equivalend module on stdlib that I didn't realize.

Upvotes: 0

Views: 220

Answers (1)

glennsl
glennsl

Reputation: 29116

When compiling to JavaScript you have Js.String.includes as replacement for Str.exists specifically, and more generally I think the Js.String module should cover most of ExtString.

When compiling to native you can just use ExtString. Reason is just an alternative syntax for OCaml, everything else works exactly the same.

Upvotes: 2

Related Questions