Anonymous user
Tokenize a string: Difference between revisions
→{{header|Delphi}}
Line 298:
<lang D>writefln( "Hello,How,Are,You,Today".split(",").join(".") );</lang>
=={{header|Delphi}}==
<lang Delphi>
program TokenizeString;
{$APPTYPE CONSOLE}
uses
Classes;
var
tmp: TStringList;
i: Integer;
begin
// Instantiate TStringList class
tmp := TStringList.Create;
try
{ Use the TStringList's CommaText property to get/set
all the strings in a single comma-delimited string }
tmp.CommaText := 'Hello,How,Are,You,Today';
{ Now loop through the TStringList and display each
token on the console }
for i := 0 to Pred(tmp.Count) do
Writeln(tmp[i]);
finally
tmp.Free;
end;
Readln;
end.
</lang>
The result is:
<lang Delphi>
Hello
How
Are
You
Today
</lang>
=={{header|E}}==
|