如何把((a+b)*c or d>0) or a=e and e>f解析成 如下三个字符串 
(a+b)*c or d>0a=ee>f请大侠们给个算法,写成函数更好,拜托啦,各位
谢谢啊~~~~~~~~~~~~~~~~~

解决方案 »

  1.   

    http://www.2ccc.com/article.asp?articleid=2370解析和计算表达式,并以树状层次显示元素关系这个东西应该是你要的记得 数据结构(大学教材)那本书,很前就有这个例子
      

  2.   

    to:hongmo(鸭鸭) 要通用的。各位大侠们继续帮忙啊,顶着有分!!
      

  3.   

    {
    把一个字符串IP,转化成INT64格式。
    }function funIPtoInteger(str: string): int64; stdcall;
    var intDotCount: integer;
      strSec: array[1..4] of string;
      i: integer;
    begin
      i := 0;
      intDotCount := 0;  for i := 0 to length(str) - 1 do
      begin
        if str[i] = '.' then
          intDotCount := intDotCount + 1;
      end;
      if intDotCount - 3 <> 0 then Result := 0;
      for i := 1 to 3 do
      begin
        strSec[i] := Copy(str, 0, Pos('.', str) - 1);
        str := Copy(str, Pos('.', str) + 1, length(str) - 1);
      end;  strSec[4] := str;  for i := 1 to 4 do
      begin
        strSec[i] := funLeftFill(strSec[i], 3);  end;  str := '';  for i := 1 to 4 do
        str := str + strSec[i];  Result := strtoint64(str);
    end;
      

  4.   

    {
    把一个字符串,左边补零到intFillCount长度
    }function funLeftFill(str: string; intFillCount: integer; intVec: Boolean = True): string; stdcall;
    var i: integer;
    begin
      i := 0;  for i := 1 to intFillCount - length(str) do
        if intVec then
          str := '0' + str
        else
          str := str + '0';
      Result := str;
    end;