简体   繁体   中英

How to make args case insensitive?

So I have this if statement

const args = message.content.slice(prefix.length).trim().split(/ +/);

if(args[0] == /word/i)

How can I make "word" case insensitive? I already tried /^word/i "word"/i

那更简单的方法呢(我想也更快)

args[0].toLowerCase() === whatEver.toLowerCase()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM