本文整理自网络,侵删。
unit Unit1;
interface
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
uses System.Character;
function getNumberFromStr(strIn: string): string;var i: integer; tempStr: string;begin tempStr := '';
if Length(strIn) = 0 then begin Result := ''; exit; end;
for i := 1 to strIn.Length do begin
if IsNumber(strIn[i]) then //isNumber--System.Character begin tempStr := tempStr + strIn[i]; end; end;
Result := tempStr;end;
procedure TForm1.FormCreate(Sender: TObject);begin caption:=getNumberFromStr('abc123456 789789');end;
end.
相关阅读 >>
Delphi用多媒体库 bass.dll 播放 mp3 - 打开、播放、暂停、停止
Delphi datasnap(midas)三层架构中,常用事件及其触发顺序
Delphi applicationevents1 webbrowser1屏蔽右键菜单
Delphi 万年历 程序源码下部分(包括:农历计算、24节气、星期计算、属相)
Delphi 获取其它软件的tlistbox句柄,怎么取得listbox中的数据
更多相关阅读请进入《Delphi》频道 >>