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 2009 泛型容器单元(generics.collections)[4]: tdictionary<t>

Delphi 替换系统文件实现绕过杀软启动

推荐一套免费跨平台的Delphi 哈希及加密算法库

Delphi 的tstringbuilder防止服务器内存碎片化

Delphi monthoftheyear、weekoftheyear、weekofthemonth、dayoftheyear … 相对时间

Delphi用命令行加载驱动

Delphi xe10 传感器操作

Delphi把一个字符串中的某个子串,用另一个子串去替换

Delphi根据url获取缓存文件的方法

Delphi 首字母转换大写

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



打赏

取消

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

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

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

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

评论

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