quote:
Originally posted by Burningmace
code:
function startsWithAlpha(message) {
[...]
}
can be reduced to one line using regexp
code:
function startsWithAlpha(message){
return /^[A-Za-z]/.test(message);
}
i'm not a master of reg exp so it might have some errors.. lol
quote:
Originally posted by vanillaflavoured
Okay so I'm making some changes to a script (for personal reasons)
*cough*punctuator*cough*
.
quote:
However my problem is I only want it to uppercase if there is actually a character a-z or A-Z as the first character as when I type Japanese characters it messes the first character up and if I try to send Messenger Plus commands like /busy or /all it creates problems with that too.
the code above should fix that.
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(startsWithAlpha(message)){
Message = "$" + Message.substr(1);
}
}
/*If I send 'LOL', it will output as '$OL'*/