Delphi TStringDynArray 使用,分割字符串


本文整理自网络,侵删。

 
uses IOUtils, Types;

procedure StringAryDelete(var A: TStringDynArray;const index: Integer);
var
   Count: Integer;
begin
  Count:= Length(A);
  if (Count = 0) or (Index < 0) or (Index >= Count) then Exit;
  Move(A[Index+1], A[Index], (Count-Index)* SizeOf(A[0]));
  SetLength(A, Count - 1);
end;
 
procedure StringAryAdd(var A: TStringDynArray; const S:  string);
var
 C:    Integer;
begin
  C:= Length(A);
  SetLength(A,C+1);
  A[C]:= S;
end;

上面的两个函数一个是用来增加 一个是用来 删除的 。

如果需要分割字符串的话 引用Strutils   使用 SplitString 即可 记得放掉哦

http://www.icy6.com/delphi/split.html

相关阅读 >>

Delphi类型转换函数

Delphi listbox 使用

Delphi编写的android程序获取root权限实现(2015.4.15更新,支持android 4.4)

Delphi webbrowser 使滚动条滚动到底部

Delphi d10.x 并行库ppl编程之 tparallel.for

Delphi xe 编译开关-一套代码不同平台编译

Delphi dataset和json互转函数

Delphi 用正则表达式获取指定的字符串续取出所有符合要求的字符串

Delphi定时器相关的简单例子

Delphi 分解链接主域名和文件名

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



打赏

取消

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

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

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

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

评论

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