<输入举例>
procedure TForm1.Button1Click(Sender: TObject);
begin
  {$I+}
  Caption := '{ [email protected] }'; //我邮箱
  { 情况还不少 }
  (* 情况还不少 *)
//{ //我喜欢用这种方法屏蔽代码
  Color := clRed;
  Font.Color := clBlue;
  //}
end;<输出举例>
procedure TForm1.Button1Click(Sender: TObject);
begin
  {$I+}
  Caption := '{ [email protected] }';
  Color := clRed;
  Font.Color := clBlue;
end;

解决方案 »

  1.   

    我以前下了一控件,那源码的关键字是大写,而且写的风格不是VCL,是C的,我就写了一个程序转换,不过我不知丢哪去了。基本上是对每行字符串中的每一个字符进行分析,基本上所有的可能都加上去了。可惜,不然贴出来看看
      

  2.   

    to copy_paste(木石三):
      总用别人的方法不好哟!很难提高
      这个问题,自己先想想看吧!
      我是考考大家,我已经写过测试过
      

  3.   

    我很菜,做就不会做了,
    但如果能跟delphi的IDE连接可能可以吧
      

  4.   

    IDE有除掉注释的功能?在哪里?我怎么不知道呀!
    这是算法问题,和工具没有关系
    也可以是除掉C、SQL、BASIC注释呀!
      

  5.   

    “上一次密码掉了才注册的,后来找了”
    (zswang递给cobi一颗珠珠糖)
    “快去做功课,不要学警察叔叔,问这问哪的”
      

  6.   

    用LR分析。我的毕业设计可以自动生成LR分析表,有了LR分析表不就简单了!
      

  7.   

    type
      TModalStr = record
        rBegin: string;
        rEnd: string;
        rAppend: string;
        rSingle: Byte;
      end;const
      cPascalCount = 5;
      cPascalList: array[0 .. Pred(cPascalCount)] of TModalStr =
    (
    (rBegin: ''''; rEnd: '''';   rAppend: '';     rSingle: 1),
    (rBegin: '{$'; rEnd: '}';    rAppend: '';     rSingle: 2),
    (rBegin: '{';  rEnd: '}';    rAppend: '';     rSingle: 3),
    (rBegin: '(*'; rEnd: '*)';   rAppend: '';     rSingle: 4),
    (rBegin: '//'; rEnd: #13#10; rAppend: #13#10; rSingle: 5)
    );const
      cSQLCount = 4;
      cSQLList: array[0 .. Pred(cSQLCount)] of TModalStr =
    (
    (rBegin: ''''; rEnd: '''';   rAppend: '';     rSingle: 1),
    (rBegin: '"';  rEnd: '"';    rAppend: '';     rSingle: 2),
    (rBegin: '/*'; rEnd: '*/';   rAppend: '';     rSingle: 3),
    (rBegin: '--'; rEnd: #13#10; rAppend: #13#10; rSingle: 4)
    );function GetModalStr(mStr: string; mModalStrList: array of TModalStr;
      mSingles: TIntegerSet): string;
    var
      vSingle: Integer;
      I, J: Integer;
      T, K: Integer;
      vEnd: string;
      vAppend: string;
    begin
      Result := '';
      vSingle := 0;
      T := 0;
      K := 0;
      for I := 1 to Length(mStr) do begin
        if T > 1 then begin
          Dec(T);
          Continue;
        end;
        if vSingle = 0 then begin
          vEnd := '';
          for J := Low(mModalStrList) to High(mModalStrList) do begin
            K := Length(mModalStrList[J].rBegin);
            if Copy(mStr, I, K) = mModalStrList[J].rBegin then begin
              vEnd := mModalStrList[J].rEnd;
              vAppend := mModalStrList[J].rAppend;
              vSingle := mModalStrList[J].rSingle;
              if vSingle in mSingles then
                Result := Result + mModalStrList[J].rBegin;
              T := K;
              K := Length(vEnd);
              Break;
            end;
          end;
          if (vEnd = '') and (vSingle in mSingles) then
            Result := Result + mStr[I];
        end else if Copy(mStr, I, K) = vEnd then begin
          if vSingle in mSingles then
            Result := Result + vEnd
          else Result := Result + vAppend;
          vSingle := 0;
          T := K;
        end else if vSingle in mSingles then
          Result := Result + mStr[I];
      end;
    end; { GetModalStr }procedure TForm1.Button1Click(Sender: TObject);
    begin
      Memo2.Text := GetModalStr(Memo1.Text, cPascalList, [0..cPascalCount] - [3, 4, 5]);
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      Memo2.Text := GetModalStr(Memo1.Text, cSQLList, [0..cSQLCount] - [3, 4]);
    end;
      

  8.   

    zswang
    我终于看懂了你的代码,累得我直喘,我真是笨哪
    不过真不错,谢谢你的代码,看来偶得好好学习阿
      

  9.   

    to xzgyb(老达摩):谢谢你的关注
      

  10.   

    谷谷谷强强强
    acgzdbbaczg
    谷谷谷强谷谷