How to match the string to the user input and then trigger it?

the user interacts with the server by entering characters

users may enter multiple characters, such as

one
two
three
four
.
50

these strings are defined and have no features. when they match this keyword, they automatically reply to the user with a fixed command

.

for example, when user input helps me find a xxx, it matches "one"

.

when the user enters another bunch of strings that match this keyword, reply to another fixed command

currently uses the match method, but each condition needs to be defined once

is there a more convenient way?

Mar.20,2021

if the program is purely implemented, the match, or indexOf you say is probably the best way, and there are no shortcuts. If you are willing to study ElasticSearch, give you Amway a wave of ElasticSearch search engine matching. The query only needs to insert the ES, query ES

Menu