Ignore:
Timestamp:
Oct 28, 2010, 9:44:09 PM (14 years ago)
Author:
george
Message:
  • Added: Specialized class TListChar aka TString.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Demo/UMainForm.pas

    r73 r74  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, ListInteger, ListString, DictionaryString, QueueInteger;
     9  ComCtrls, ListInteger, ListString, DictionaryString, QueueInteger, ListChar;
    1010
    1111type
     
    1414
    1515  TMainForm = class(TForm)
     16    ButtonCharList: TButton;
    1617    ButtonQueueInteger: TButton;
    1718    ButtonDictionaryString: TButton;
     
    1920    ButtonStringList: TButton;
    2021    MemoOutput: TMemo;
     22    procedure ButtonCharListClick(Sender: TObject);
    2123    procedure ButtonDictionaryStringClick(Sender: TObject);
    2224    procedure ButtonIntegerListClick(Sender: TObject);
     
    123125end;
    124126
     127function CharToStr(Value: Char): string;
     128begin
     129  Result := Value;
     130end;
     131
     132procedure TMainForm.ButtonCharListClick(Sender: TObject);
     133var
     134  List: TListChar;
     135begin
     136  MemoOutput.Clear;
     137  WriteLn('TListChar test');
     138  List := TListChar.Create;
     139  with List do try
     140    AddArray([' ', ' ', 'A', 'b', 'c', 'd', ' ']);
     141    WriteLn('Implode: ''' + Implode('', CharToStr) + '''');
     142    WriteLn('Implode: ' + Implode('', CharToStr));
     143    WriteLn('Reverse');
     144    Reverse;
     145    WriteLn('Implode: ''' + Implode('', CharToStr) + '''');
     146    WriteLn('TrimLeft');
     147    TrimLeft;
     148    WriteLn('Implode: ''' + Implode('', CharToStr) + '''');
     149    WriteLn('TrimRight');
     150    TrimRight;
     151    WriteLn('Implode: ''' + Implode('', CharToStr) + '''');
     152    WriteLn('UpperCase');
     153    UpperCase;
     154    WriteLn('Implode: ''' + Implode('', CharToStr) + '''');
     155  finally
     156    Free;
     157  end;
     158end;
     159
    125160function StrToStr(Value: string): string;
    126161begin
Note: See TracChangeset for help on using the changeset viewer.