Blog信息 |
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3269002 建立时间:2005年6月6日 |

| |
[delpih编程]自修改的SplitString完成字符串分割,结果返回到一个stringlist列表 软件技术
吕向阳 发表于 2009/6/29 6:53:10 |
自修改的SplitString完成字符串分割,结果返回到一个stringlist列表绝大部分范例实际中用分割符为一个字符,而不是一个字符串,使用范围很窄。下例中ch可以是多个字符的字符窜。function SplitString(const Source, ch: string): TStringList;vartemp: string;i: Integer;len1: integer;beginResult := TStringList.Create;if Source = '' thenexit;temp := Source;len1 := length(ch);i := pos(ch, Source);while i <> 0 dobeginResult.add(copy(temp, 0, i - 1));Delete(temp, 1, i + len1 - 1);i := pos(ch, temp);end;Result.add(temp);end; |
|
|