I am dealing with a string called uppercase
, where if it contains letters nothing happens. However, if there are no letters in the string, then it evaluates uppercase
. This is what I'm currently trying to accomplish using an if
and else
statement:
if(uppercase.substring(0,9) == "CALCULATE")
{
if(uppercase.substring(10,uppercase.length.contains("[a-zA-Z]+")))
{
} else{
var ans = eval(uppercase.substring(9,uppercase.length));
sendSpecialChat = [true, ans];
}
}
However, my code isn't working as expected. Can anyone help me identify what might be going wrong?