delphi - delphi中如何分割字符串

标签 delphi delphi-2010

我只需要将 "STANS", "Payment, chk#1", ,1210.000 这样的字符串拆分为基于 , 的数组。字符串列表中的结果将是

STANS  
Payment, chk#1  

1210.000

最佳答案

创建一个TStringList并将逗号分隔的字符串分配给StringList.CommaText。这会解析您的输入并将分割的字符串作为字符串列表的项目返回。

StringList.CommaText := '"STANS", "Payment, chk# 1", ,1210.000';
//StringList[0]='STANS'
//StringList[1]='Payment, chk# 1'
//etc.

关于delphi - delphi中如何分割字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6301976/

相关文章:

delphi - 改变 TComboBox 的 ITEMINDEX 不会触发它的 OnChange 事件

Delphi - 分配给 'x' 的值从未使用过

delphi - 德尔福XE上的ERangeError

windows - 寻找外部窗口的位置?

delphi - AdoQuery 如何处理 blob?

delphi - 如何将对象转换为接口(interface)(Delphi 中的通用类型约束)

delphi - 如何在不使用 alClient 对齐的情况下调整 TGridPanel 内 TEdit 的大小

delphi - Delphi 2010 中的代码完成速度是否有所提高?

Delphi #IF(DEBUG) 等效吗?

json - 使用 Delphi 7 解析 JSON