日期:2014-05-17 浏览次数:20873 次
static bool ParseString(string str)
{
bool result = false;
Stack<char> symbols = new Stack<char>();
for (int i = 0; i < str.Length; i++)
{
char ch = str[i];
switch (ch)
{
case '(':
case '[':
case '{':
symbols.Push(ch);
break;
case ')':
if (symbols.Count > 0 && symbols.Peek() == '(')
symbols.Pop();
else
return false;
break;