How to get the next letter of the alphabet in Javascript?

后端 未结 7 984
醉酒成梦
醉酒成梦 2021-01-03 18:20

I am build an autocomplete that searches off of a CouchDB View.

I need to be able to take the final character of the input string, and replace the last character wit

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 18:34

    my_string.substring(0, my_string.length - 1)
          + String.fromCharCode(my_string.charCodeAt(my_string.length - 1) + 1)
    

提交回复
热议问题