Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
浏览Rescript 的 API后,似乎没有比较两个返回布尔值的字符串的函数。最好的选择是localeCompare,但它的行为与 JS 的==. 为什么localeCompare返回浮点数而不是整数?
localeCompare
==
==您也可以使用in rescript比较字符串。或者,String.equal如果您需要一个专门限于字符串的函数,Js那么不幸的是,“本机”(非)标准库模块String似乎完全被排除在 rescript 文档之外。
String.equal
Js
String
localeComapre可能返回 afloat因为它可能返回非整数。不幸的是,JavaScript 没有整数类型,这使得很难知道它是否可以返回floats,即使看起来很明显它不应该返回。我自己在各种绑定中看到了几种此类错误。
localeComapre
float