delphi从字符串中取出数字


本文整理自网络,侵删。

 type
TCharSet = set of Char;

function StripNonConforming(const S: string;
const ValidChars: TCharSet): string;
var
DestI: Integer;
SourceI: Integer;
begin
SetLength(Result, Length(S));
DestI := 0;
for SourceI := 1 to Length(S) do
if S[SourceI] in ValidChars then
begin
Inc(DestI);
Result[DestI] := S[SourceI]
end;
SetLength(Result, DestI)
end;

function StripNonNumeric(const S: string): string;
begin
Result := StripNonConforming(S, ['0'..'9'])
end;

相关阅读 >>

Delphi 超短精简进制转换

Delphi reset 以只读方式打开文件

Delphi编程之显示桌面分辨率

Delphi 最简单的文件大小bytes转mb

Delphi关闭程序close,application.terminate与halt区别

Delphi7调用Delphi xe2 中间层注意事项

Delphi listview排序

Delphi url解�a函��(by kingron)

Delphi 替换其他程序里面的函数为自己的函数

Delphi 去掉treeview水平滚动条

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...