zoukankan      html  css  js  c++  java
  • 有什么工具快速删除delphi源代码的注释(帖子)?

    发表于:2008-07-12 17:44:04 楼主
    有什么工具快速删除delphi源代码的注释?有很乱的代码需要重新整理一遍,单独删除太烦。
    发表于:2008-07-12 18:04:251楼 得分:1
    没见过,关注
    发表于:2008-07-12 18:22:502楼 得分:19
    下面的代码注释已经被删了。
    测试时Memo1.Text放入含注释代码。
    Delphi(Pascal) code
                
    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Memo1: TMemo; Button1: TButton; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.dfm} 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; procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Text := GetModalStr(Memo1.Text, cPascalList, [0, 1, 2]); end; end.

    自己加工一下做个工具,将代码载入到TStringList中通过Text属性处理即可。图
  • 相关阅读:
    hdu 4612 Warm up 双连通缩点+树的直径
    Hadoop-04-HBase全然分布式环境搭建
    java实现的Trie树数据结构
    Sharpui企业版-简单介绍【01】 【QQ群:206378966】
    Apache Mina开发手冊之四
    POJ训练计划1459_Power Network(网络流最大流/Dinic)
    svn+ssh
    Android首席设计师宣称移动概念已死,开发人员应该面向屏幕编写应用而非移动
    连锁快餐企业软件的一些管理
    多进程解决datasnap支持的tcp长连接数量少的问题
  • 原文地址:https://www.cnblogs.com/feng801/p/1286639.html
Copyright © 2011-2022 走看看