published { Published declarations } end; procedure Register; implementation procedure Register; begin RegisterComponents('SkyDevKit', [TSkyStringTokenizer]); end; { TStringTokenizer } function TSkyStringTokenizer.hasNext: boolean; begin result := (index < tokens.Count - 1); end; procedure TSkyStringTokenizer.init(dataLine, delim: string); begin tokens := TStringList.Create(); delimiter := delim; data := dataLine; tokens := SplitString(data, delimiter); //tokens := data.Split(delimiter.ToCharArray()); index := -1; end; function TSkyStringTokenizer.next: string; var s: string; begin inc(index); s := tokens[index]; while ((length(s) <= 0) and (index < tokens.Count)) do begin inc(index); s := tokens[index]; end; result := s; |
正在阅读:用Delphi实现StringTokenizer功能用Delphi实现StringTokenizer功能
2004-02-14 09:34
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键