delphi能否快速获得一个文本文件中某个字符的数目
解决方案 »
- 谈谈网络赚钱 (进者有分)
- 各位兄弟帮我看看这个帖!!
- 如何在程序中运行文本文件中数据库Sql脚本(一次执行多个sql语句)
- 登陆界面的设计和权限的控制。
- 有Rave reports高手吗? 请问怎么在delphi中通过程序控制rave中的控件.(例如通过单击按钮来给rave中的组件赋值.).还有,怎么在rave中调出每
- RAVE報表問題
- to: ljq_2002
- 做一个RunTime Form Designer,不知有什么思路?(高手请进)
- 求大侠,急救,socket 多线程问题
- 关于如何使的ActiveXForm控件能够在网页里接收参数的问题
- 晕,为什么会这样??有关调用excel模板的新手问题,大哥帮帮忙吧!!!
- adoquery數據操作
mStr: string; //源字符串
mSub: string //子串
): Integer; //返回子串的个数
begin
Result := (Length(mStr) - Length(
StringReplace(mStr, mSub, '', [rfReplaceAll]))) div Length(mSub);
end; { SubStrConut }//....
begin
with TStringList.Create do try
LoadFromFile('c:\temp\temp.txt');
Caption := IntToStr(SubStrConut(Text, 'a'));
finally
Free;
end;
end;
begin
with TStringList.Create do try
LoadFromFile('c:\temp\temp.txt');
Caption := IntToStr(SubStrConut(Text, 'a'));
finally
Free;
end;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}function SubStrConut( //计算子串的个数
mStr: string; //源字符串
mSub: string //子串
): Integer; //返回子串的个数
begin
Result := (Length(mStr) - Length(
StringReplace(mStr, mSub, '', [rfReplaceAll]))) div Length(mSub);
end; { SubStrConut }procedure TForm1.FormCreate(Sender: TObject);
begin
with TStringList.Create do try
LoadFromFile('c:\temp\temp.txt');
Caption := IntToStr(SubStrConut(Text, 'a'));
finally
Free;
end;
end;end.