Possible Duplicate:
Emulating SQL LIKE in JavaScript
Is there an operator in JavaScript which is similar to the like
operator in SQL? Explanations and examples are appreciated.
No, there isn't any. The list of comparison operators are listed here.
SQL. js is a JavaScript library that allows you to create and query a relational database entirely in the browser. It uses a virtual database file stored in the browser memory, so it doesn't persist the changes made to the database.
You can use regular expressions in Javascript to do pattern matching of strings.
For example:
var s = "hello world!"; if (s.match(/hello.*/)) { // do something }
The match()
test is much like WHERE s LIKE 'hello%'
in SQL.
No.
You want to use: .indexOf("foo")
and then check the index. If it's >= 0, it contains that string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With