March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -2,16 +2,24 @@ program TokenizeString;
{$mode objfpc}{$H+}
uses
SysUtils, Classes;
const
CHelloStr = 'Hello,How,Are,You,Today';
TestString = 'Hello,How,Are,You,Today';
var
Tokens: TStringList;
I: Integer;
VResult: string = '';
begin
for I := 1 to Length(CHelloStr) do
if CHelloStr[I] = ',' then
VResult += LineEnding
else
VResult += CHelloStr[I];
WriteLn(VResult);
// Uses FCL facilities, "harder" algorithm not implemented
Tokens := TStringList.Create;
try
Tokens.Delimiter := ',';
Tokens.DelimitedText := TestString;
Tokens.Delimiter := '.'; // For example
// To standard Output
WriteLn(Format('Tokenize from: "%s"', [TestString]));
WriteLn(Format('to: "%s"',[Tokens.DelimitedText]));
finally
Tokens.Free;
end;
end.