[问题] 字串符号检查的问题

楼主: crowley (苍蝇拍)   2018-04-19 17:55:22
if (wordSt.endsWith("(")){
theStack.push(wordSt.charAt(0));
}
else if(wordSt.endsWith(")")){
theStack.pop();
}
要判断字串中的括号是否正确
现在我只能正确判断( )而已
但是我想要[ ]和{ }也能判断的话
该怎么处理呢?
感谢各位大大
作者: tong87   2018-04-19 19:32:00
用Regex
作者: qui1218 (^_^)   2018-04-19 23:17:00
Regular expression
作者: inxbone (高级少量糖果)   2018-04-20 00:19:00
就遇到右边的括号判断pop出来的值符不符合

Links booklink

Contact Us: admin [ a t ] ucptt.com