This article covers features introduced in SpiderMonkey 1.8.5
Compare flat string and ASCII string.
Syntax
bool JS_StringEqualsAscii(JSContext *cx, JSString *str, const char *asciiBytes, bool *match); bool JS_FlatStringEqualsAscii(JSFlatString *str, const char *asciiBytes);
Name | Type | Description |
---|---|---|
cx |
JSContext * |
A context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext . |
str |
JSFlatString * |
String to compare. |
asciiBytes |
const char * |
ASCII string to compare with. |
match |
bool * |
(JS_StringEqualsAscii only) Out parameter. Received the comparison result. |
Description
JS_StringEqualsAscii
and JS_FlatStringEqualsAscii
compare string str
and ASCII string asciiBytes
.
On successful, JS_StringEqualsAscii
stores the comparison result into *match
and returns true
, otherwise returns false
.
JS_FlatStringEqualsAscii
always succeeds, and returns the comparison result.