I have a list of keyCode which stand for separator keys. After user inputs a string (from a textbox), how can I split that string by a list of keyCode? So far split() function is allowed string or regexp, I found nothing when converting keyCode to regexp.
What should I do in this case?
For example:
separators = [
mdConstants.KEY_CODE.COMMA // 188
mdConstants.KEY_CODE.DASH: // 189
...
]
Input -> Output
------------------
abc-def -> [ abc, def ]
abc-def.efg -> [ abc, def, efg ]