I want to implement a function, that is, when the user enters 10 digits in input
and clicks the query button
, it will match the pre-input value in the json
data. , and feed back different query results based on different information.
However, the input-ahead value of json
is only 8 or 6 digits (corresponding to the first 8 or 6 digits of the 10-digit number, the matching priority is 8 digits first and 6 digits later). Please tell me how to make this query judgment? Thanks!
json
Format:
{"id":"123456","info":"这是普通用户"},
{"id":"87654321","info":"这是高级用户"}
{"id":"876543","info":"这是尊享用户"}
For example, the user input is 1234567890
, and the pre-input value in the json
data is 123456
, Then match the information of this input-ahead value. If the user input is 0987654321
, the input-ahead value in the json
data is 098765# When both
## and 09876543 are used, the information of the pre-input value of 09876543
will be matched.
PS: I have fallen into a dead end of fuzzy query, and I can’t get around it. . .
It’s very cheating. You need to traverse all the data, so let the background do this kind of thing.