How to implement StringTokenizer function with Delphi:
We know that there is StringTokenizer in Java, which is very convenient for string processing, but this function is not provided in Delphi. I refer to the Delphi version and C# version of the Java language to implement this function. Hope to provide you with a convenience. Hope you can give me more advice. [email protected] unit SkyStringTokenizer; {String analysis and processing class author: Zeng Qingsong Time: 2004/2/21 (New Year's Eve, 2003) } interface uses SysUtils, Classes; type IIterator = interface function hasNext(): boolean; function next (): string; end; type TSkyStringTokenizer = class(TComponent, IIterator) private tokens: TStringList; index: integer; data: string; delimiter: string; procedure init(dataLine: string; delim: string); function CharacterInTokens(ch: string; const sl: TStringList): boolean; function StringToCharArray(delim: string): TStringList; function SplitString(source, ch: string): Tstringlist; protected { Protected declarations } public { Public declarations } constructor create(dataLine: string); overload; constructor Create(dataLine: string; delim: string); overload; destructor destroy();override; function hasNext(): boolean; function next(): string;