home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / delphi / tstrclas.lzh / TESTBED.PAS < prev   
Pascal/Delphi Source File  |  1995-11-18  |  61KB  |  2,168 lines

  1. unit Testbed;
  2.  
  3. interface
  4.  
  5. uses
  6.  
  7.    SysUtils,
  8.    WinTypes,
  9.    WinProcs,
  10.    Messages,
  11.    Classes,
  12.    Graphics,
  13.    Controls,
  14.    Forms,
  15.    Dialogs,
  16.    StdCtrls,
  17.    ExtCtrls,
  18.    SafeStr,
  19.    StrClass,
  20.    ContainR, Console, Buttons;
  21.  
  22. type
  23.   TSCTestBed = class(TForm)
  24.     FuncLb    : TListbox;
  25.     GroupBox1 : TGroupBox;
  26.     Label4: TLabel;
  27.     Label2: TLabel;
  28.     Label3: TLabel;
  29.     procedure Button1Click(Sender: TObject);
  30.     procedure FormCreate(Sender: TObject);
  31.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  32.     procedure FuncLbClick(Sender: TObject);
  33.   private
  34.      TheFuncList : TRecordContainer;
  35.     { Private declarations }
  36.     PROCEDURE RunTest(fid : WORD);
  37.     PROCEDURE SetupFuncLb;
  38.   public
  39.     { Public declarations }
  40.     OutConsole: TConsole;
  41.   end;
  42.  
  43. var
  44.   SCTestBed: TSCTestBed;
  45.  
  46. implementation
  47.  
  48. {$R *.DFM}
  49.  
  50. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  51.  
  52. CONST
  53.  
  54.    id_Create = 1;
  55.    id_CreateSize = 2;
  56.    id_CreateString =3;
  57.    id_CreateStringNL = 4;
  58.    id_CreateBoolean = 5;
  59.    id_Destroy = 6;
  60.    id_Copy = 7;
  61.    id_CopyFrom = 8;
  62.    id_Clear = 9;
  63.    id_Empty = 10;
  64.    id_Assign = 11;
  65.    id_AssignFrom = 12;
  66.    id_AssignLen = 13;
  67.    id_AssignMid = 14;
  68.    id_AssignNL = 15;
  69.    id_AssignPad = 16;
  70.    id_AssignRight = 17;
  71.    id_AssignTrim = 18;
  72.    id_Append = 19;
  73.    id_AppendBoolean = 20;
  74.    id_AppendByte = 21;
  75.    id_AppendCh = 22;
  76.    id_AppendDIC = 23;
  77.    id_AppendDouble = 24;
  78.    id_AppendDoubleTrim = 25;
  79.    id_AppendExt = 26;
  80.    id_AppendExtTrim = 27;
  81.    id_AppendLen = 28;
  82.    id_AppendLong = 29;
  83.    id_AppendMid = 30;
  84.    id_AppendNL = 31;
  85.    id_AppendPad = 32;
  86.    id_AppendPtr = 33;
  87.    id_AppendReal = 34;
  88.    id_AppendRight = 35;
  89.    id_AppendSIC = 36;
  90.    id_AppendTrim = 37;
  91.    id_AppendWithTab = 38;
  92.    id_NLAppend = 39;
  93.    id_Prepend = 40;
  94.    id_FirstNonSpaceCh = 41;
  95.    id_HasCh = 42;
  96.    id_isCh = 43;
  97.    id_IsFirstCh = 44;
  98.    id_IsLastCh = 45;
  99.    id_LastNonSpaceCh = 46;
  100.    id_RemoveLastCh = 47;
  101.    id_SetCh = 48;
  102.    id_FromBoolean = 49;
  103.    id_FromByte = 50;
  104.    id_FromChar = 51;
  105.    id_FromDouble = 52;
  106.    id_FromDoubleTrim = 53;
  107.    id_FromExt = 54;
  108.    id_FromExtTrim  = 55;
  109.    id_FromLong = 56;
  110.    id_FromPtr = 57;
  111.    id_FromReal = 58;
  112.    id_FromRealTrim = 59;
  113.    id_FromRGB = 60;
  114.    id_HexFromByte = 61;
  115.    id_HexFromLong = 62;
  116.    id_HexFromPtr = 63;
  117.    id_HexFromWord = 64;
  118.    id_ToBoolean = 65;
  119.    id_ToByte = 66;
  120.    id_ToChar = 67;
  121.    id_ToDouble = 68;
  122.    id_ToExt = 69;
  123.    id_ToInteger = 70;
  124.    id_ToLong = 71;
  125.    id_ToReal = 72;
  126.    id_ToRGB = 73;
  127.    id_ToWord = 74;
  128.    id_AppendStr = 75;
  129.    id_UpperCase = 76;
  130.    id_LowerCase = 77;
  131.    id_CompareStr = 78;
  132.    id_CompareText = 79;
  133.    id_AnsiUpperCase = 80;
  134.    id_AnsiLowerCase = 81;
  135.    id_AnsiCompareStr = 82;
  136.    id_AnsiCompareText = 83;
  137.    id_IsValidIdent = 84;
  138.    id_IntToStr = 85;
  139.    id_IntToHex = 86;
  140.    id_StrToInt = 87;
  141.    id_StrToIntDef = 88;
  142.    id_LoadStr = 89;
  143.    id_FmtLoadStr = 90;
  144.    id_Format = 91;
  145.    id_FloatToStr = 92;
  146.    id_FloatToStrF = 93;
  147.    id_FormatFloat = 94;
  148.    id_StrToFloat = 95;
  149.    id_StrCat = 96;
  150.    id_StrComp = 97;
  151.    id_StrCopy = 98;
  152.    id_StrECopy = 99;
  153.    id_StrEnd = 100;
  154.    id_StrIComp = 101;
  155.    id_StrLCat = 102;
  156.    id_StrLIComp = 103;
  157.    id_StrLComp = 104;
  158.    id_StrLCopy = 105;
  159.    id_StrLen = 106;
  160.    id_StrLower = 107;
  161.    id_StrMove = 108;
  162.    id_StrPas = 109;
  163.    id_StrPCopy = 110;
  164.    id_StrPos = 111;
  165.    id_StrRScan = 112;
  166.    id_StrScan = 113;
  167.    id_StrUpper = 114;
  168.    id_Compare = 115;
  169.    id_CompareI = 116;
  170.    id_CompareL = 117;
  171.    id_CompareLI = 118;
  172.    id_CompareLong = 119;
  173.    id_CompareDouble = 120;
  174.    id_CompareExt = 121;
  175.    id_IsSame = 122;
  176.    id_isSameL = 123;
  177.    id_IsSameLI = 124;
  178.    id_Includes = 125;
  179.    id_Within = 126;
  180.    id_Delete = 127;
  181.    id_Insert = 128;
  182.    id_InsertL = 129;
  183.    id_PadCentre = 130;
  184.    id_PadEnd = 131;
  185.    id_PadFront = 132;
  186.    id_RemoveDIC = 133;
  187.    id_RemoveSIC = 134;
  188.    id_Trim = 135;
  189.    id_TrimEnd = 136;
  190.    id_TrimFront = 137;
  191.    id_TrimZero = 138;
  192.    id_FindCmdLine = 139;
  193.    id_FindCmdLineAndParse = 140;
  194.    id_FindCmdLineParam = 141;
  195.    id_AppendStringRes = 142;
  196.    id_LoadStringRes = 143;
  197.    id_ReadIniKeyword = 144;
  198.    id_WriteIniKeyword = 145;
  199.    id_FindIniSectionKeywords = 146;
  200.    id_AddBackSlash = 147;
  201.    id_BuildPathName = 148;
  202.    id_DefaultExtension = 149;
  203.    id_ExpandFileName = 150;
  204.    id_ForceExtension = 151;
  205.    id_HasBackSlash = 152;
  206.    id_HasDrive = 153;
  207.    id_HasExtension = 154;
  208.    id_HasFileName = 155;
  209.    id_HasDirectory = 156;
  210.    id_DirectoryExists = 157;
  211.    id_DriveExists = 158;
  212.    id_FileExists = 159;
  213.    id_JustExtension = 160;
  214.    id_JustFileName = 161;
  215.    id_JustDirectory = 162;
  216.    id_SetCurDir = 163;
  217.    id_ChCount = 164;
  218.    id_FindBetween2Ch = 165;
  219.    id_FindFirst = 166;
  220.    id_FindFirstCh = 167;
  221.    id_FindLast = 168;
  222.    id_FindLastCh = 169;
  223.    id_FindNext = 170;
  224.    id_FindNextCh = 171;
  225.    id_FindPrev = 172;
  226.    id_FindPrevCh = 173;
  227.    id_SubStrCount = 174;
  228.    id_FirstCharToUpper = 175;
  229.    id_IsAlphaNumeric = 176;
  230.    id_ToLower = 177;
  231.    id_ToUpper = 178;
  232.    id_ReplaceAll = 179;
  233.    id_ReplaceFirst = 180;
  234.    id_ReplaceLast = 181;
  235.    id_ReplaceChAll = 182;
  236.    id_ReplaceChFirst = 183;
  237.    id_ReplaceChLast = 184;
  238.    id_FirstParseDelim = 185;
  239.    id_NextParseDelim = 186;
  240.    id_ParseDelimCount = 187;
  241.    id_ParseDelimToList = 188;
  242.    id_ParsePosToList = 189;
  243.    id_SameI          = 190;
  244.    id_JustName       = 191;
  245.    id_FileSplit      = 192;
  246.    id_FindCurrentDir = 193;
  247.    id_DeleteFrom     = 194;
  248.    id_FindRelPath    = 195;
  249.    id_ParseMultiDelimToList = 196;
  250.    id_Grep = 197;
  251.    id_AddFilterDesc = 198;
  252.    id_RecalcLength = 199;
  253.    id_NL = 200;
  254.    id_FromComponent = 201;
  255.    id_FromComponentItem = 202;
  256.    id_ToComponent = 203;
  257.    id_IsSameI = 204;
  258.    id_CreateDirectory = 205;
  259.    id_RemoveDirectory = 206;
  260.    id_SameDrive = 207;
  261.    id_SameDirectory = 208;
  262.    id_SameExtension = 209;
  263.    id_SameFileName = 210;
  264.    id_SameName = 211;
  265.  
  266. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  267.  
  268. TYPE
  269.  
  270.    PFunctionRecord = ^TFunctionRecord;
  271.    TFunctionRecord = RECORD
  272.       Id   : WORD;
  273.       Name : PChar;
  274.    END;
  275.  
  276. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  277.  
  278. procedure TSCTestBed.Button1Click(Sender: TObject);
  279. begin
  280.    Close;
  281. end;
  282.  
  283. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  284.  
  285. procedure TSCTestBed.FormCreate(Sender: TObject);
  286. begin
  287.    { clear memo control }
  288.    OutConsole := TConsole.Create(Self);
  289.    OutConsole.Parent := GroupBox1;
  290.    OutConsole.Left := 8;
  291.    OutConsole.Top := 24;
  292.    OutConsole.Width := 569;
  293.    OutConsole.Height := 200;
  294.    OutConsole.Options := OutConsole.Options + [coStdOutput];
  295.    { create container to hold id/func name recs }
  296.    TheFuncList := TRecordContainer.Create(SIZEOF(TFunctionRecord));
  297.    SetupFuncLb;
  298. end;
  299.  
  300. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  301.  
  302. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  303.  
  304. procedure TSCTestBed.FormClose(Sender: TObject; var Action: TCloseAction);
  305.  
  306.    { ++++++++++++++++++++++++++++++++++++++++++++++++++ }
  307.  
  308.    PROCEDURE KillStr(R : PFunctionRecord); FAR;
  309.    BEGIN
  310.       StrDispose(R^.Name);
  311.    END;
  312.  
  313.    { ++++++++++++++++++++++++++++++++++++++++++++++++++ }
  314.  
  315. begin
  316.    TheFuncList.ForEach(@KillStr);
  317.    TheFuncList.Free;
  318. end;
  319.  
  320. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  321.  
  322. PROCEDURE TScTestbed.SetupFuncLb;
  323.  
  324.    { ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  325.  
  326.    PROCEDURE AddItem(id : INTEGER; AStr : PChar);
  327.    VAR
  328.       R : PFunctionRecord;
  329.    BEGIN
  330.       FuncLb.Items.Add(StrPas(AStr));
  331.       NEW(R);
  332.       R^.Id := id;
  333.       R^.Name := StrNew(AStr);
  334.       TheFuncList.Add(R);
  335.    END;
  336.  
  337.    { ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  338.  
  339. BEGIN
  340.    AddItem(id_Create,'Create');
  341.    AddItem(id_CreateSize,'CreateSize');
  342.    AddItem(id_CreateString,'CreateString');
  343.    AddItem(id_CreateStringNL,'CreateStringNL');
  344.    AddItem(id_CreateBoolean,'CreateBoolean');
  345.    AddItem(id_Destroy,'Destroy');
  346.    AddItem(id_Copy,'Copy');
  347.    AddItem(id_CopyFrom,'CopyFrom');
  348.    AddItem(id_Clear,'Clear');
  349.    AddItem(id_Empty,'Empty');
  350.    AddItem(id_RecalcLength,'RecalcLength');
  351.    AddItem(id_Assign,'Assign');
  352.    AddItem(id_AssignFrom,'AssignFrom');
  353.    AddItem(id_AssignLen,'AssignLen');
  354.    AddItem(id_AssignMid,'AssignMid');
  355.    AddItem(id_AssignNL,'AssignNL');
  356.    AddItem(id_AssignPad,'AssignPad');
  357.    AddItem(id_AssignRight,'AssignRight');
  358.    AddItem(id_AssignTrim,'AssignTrim');
  359.    AddItem(id_Append,'Append');
  360.    AddItem(id_AppendBoolean,'AppendBoolean');
  361.    AddItem(id_AppendByte,'AppendByte');
  362.    AddItem(id_AppendCh,'AppendCh');
  363.    AddItem(id_AppendDIC,'AppendDIC');
  364.    AddItem(id_AppendDouble,'AppendDouble');
  365.    AddItem(id_AppendDoubleTrim,'AppendDoubleTrim');
  366.    AddItem(id_AppendExt,'AppendExt');
  367.    AddItem(id_AppendExtTrim,'AppendExtTrim');
  368.    AddItem(id_AppendLen,'AppendLen');
  369.    AddItem(id_AppendLong,'AppendLong');
  370.    AddItem(id_AppendMid,'AppendMid');
  371.    AddItem(id_AppendNL,'AppendNL');
  372.    AddItem(id_AppendPad,'AppendPad');
  373.    AddItem(id_AppendPtr,'AppendPtr');
  374.    AddItem(id_AppendReal,'AppendReal');
  375.    AddItem(id_AppendRight,'AppendRight');
  376.    AddItem(id_AppendSIC,'AppendSIC');
  377.    AddItem(id_AppendTrim,'AppendTrim');
  378.    AddItem(id_AppendWithTab,'AppendWithTab');
  379.    AddItem(id_NL,'NL');
  380.    AddItem(id_NLAppend,'NLAppend');
  381.    AddItem(id_Prepend,'Prepend');
  382.    AddItem(id_FirstNonSpaceCh,'FirstNonSpaceCh');
  383.    AddItem(id_HasCh,'HasCh');
  384.    AddItem(id_isCh,'IsCh');
  385.    AddItem(id_IsFirstCh,'IsFirstCh');
  386.    AddItem(id_IsLastCh,'IsLastCh');
  387.    AddItem(id_LastNonSpaceCh,'LastNonSpaceCh');
  388.    AddItem(id_RemoveLastCh,'RemoveLastCh');
  389.    AddItem(id_SetCh,'SetCh');
  390.    AddItem(id_FromBoolean,'FromBoolean');
  391.    AddItem(id_FromByte,'FromByte');
  392.    AddItem(id_FromChar,'FromChar');
  393.    AddItem(id_FromComponent,'FromComponent');
  394.    AddItem(id_FromComponentItem,'FromComponentItem');
  395.    AddItem(id_FromDouble,'FromDouble');
  396.    AddItem(id_FromDoubleTrim,'FromDoubleTrim');
  397.    AddItem(id_FromExt,'FromExt');
  398.    AddItem(id_FromExtTrim,'FromExtTrim');
  399.    AddItem(id_FromLong,'FromLong');
  400.    AddItem(id_FromPtr,'FromPtr');
  401.    AddItem(id_FromReal,'FromReal');
  402.    AddItem(id_FromRealTrim,'FromRealTrim');
  403.    AddItem(id_FromRGB,'FromRGB');
  404.    AddItem(id_HexFromByte,'HexFromByte');
  405.    AddItem(id_HexFromLong,'HexFromLong');
  406.    AddItem(id_HexFromPtr,'HexFromPtr');
  407.    AddItem(id_HexFromWord,'HexFromWord');
  408.    AddItem(id_ToBoolean,'ToBoolean');
  409.    AddItem(id_ToByte,'ToByte');
  410.    AddItem(id_ToChar,'ToChar');
  411.    AddItem(id_ToComponent,'ToComponent');
  412.    AddItem(id_ToDouble,'ToDouble');
  413.    AddItem(id_ToExt,'ToExt');
  414.    AddItem(id_ToInteger,'ToInteger');
  415.    AddItem(id_ToLong,'ToLong');
  416.    AddItem(id_ToReal,'ToReal');
  417.    AddItem(id_ToRGB,'ToRGB');
  418.    AddItem(id_ToWord,'ToWord');
  419.    AddItem(id_AppendStr,'AppendStr');
  420.    AddItem(id_UpperCase,'UpperCase');
  421.    AddItem(id_LowerCase,'LowerCase');
  422.    AddItem(id_CompareStr,'CompareStr');
  423.    AddItem(id_CompareText,'CompareText');
  424.    AddItem(id_AnsiUpperCase,'AnsiUpperCase');
  425.    AddItem(id_AnsiLowerCase,'AnsiLowerCase');
  426.    AddItem(id_AnsiCompareStr,'AnsiCompareStr');
  427.    AddItem(id_AnsiCompareText,'AnsiCompareText');
  428.    AddItem(id_IsValidIdent,'IsValidIdent');
  429.    AddItem(id_IntToStr,'IntToStr');
  430.    AddItem(id_IntToHex,'IntToHex');
  431.    AddItem(id_StrToInt,'StrToInt');
  432.    AddItem(id_StrToIntDef,'StrToIntDef');
  433.    AddItem(id_LoadStr,'LoadStr');
  434.    AddItem(id_FmtLoadStr,'FmtLoadStr');
  435.    AddItem(id_Format,'Format');
  436.    AddItem(id_FloatToStr,'FloatToStr');
  437.    AddItem(id_FloatToStrF,'FloatToStrF');
  438.    AddItem(id_FormatFloat,'FormatFloat');
  439.    AddItem(id_StrToFloat,'StrToFloat');
  440.    AddItem(id_StrCat,'StrCat');
  441.    AddItem(id_StrComp,'StrComp');
  442.    AddItem(id_StrCopy,'StrCopy');
  443.    AddItem(id_StrECopy,'StrECopy');
  444.    AddItem(id_StrEnd,'StrEnd');
  445.    AddItem(id_StrIComp,'StrIComp');
  446.    AddItem(id_StrLCat,'StrLCat');
  447.    AddItem(id_StrLIComp,'StrLIComp');
  448.    AddItem(id_StrLComp,'StrLComp');
  449.    AddItem(id_StrLCopy,'StrLCopy');
  450.    AddItem(id_StrLen,'StrLen');
  451.    AddItem(id_StrLower,'StrLower');
  452.    AddItem(id_StrMove,'StrMove');
  453.    AddItem(id_StrPas,'StrPas');
  454.    AddItem(id_StrPCopy,'StrPCopy');
  455.    AddItem(id_StrPos,'StrPos');
  456.    AddItem(id_StrRScan,'StrRScan');
  457.    AddItem(id_StrScan,'StrScan');
  458.    AddItem(id_StrUpper,'StrUpper');
  459.    AddItem(id_Compare,'Compare');
  460.    AddItem(id_CompareI,'CompareI');
  461.    AddItem(id_CompareL,'CompareL');
  462.    AddItem(id_CompareLI,'CompareLI');
  463.    AddItem(id_CompareLong,'CompareLong');
  464.    AddItem(id_CompareDouble,'CompareDouble');
  465.    AddItem(id_CompareExt,'CompareExt');
  466.    AddItem(id_IsSame,'IsSame');
  467.    AddItem(id_IsSameI,'IsSameI');
  468.    AddItem(id_isSameL,'IsSameL');
  469.    AddItem(id_IsSameLI,'IsSameLI');
  470.    AddItem(id_Includes,'Includes');
  471.    AddItem(id_Within,'Within');
  472.    AddItem(id_Delete,'Delete');
  473.    AddItem(id_DeleteFrom,'DeleteFrom');
  474.    AddItem(id_Insert,'Insert');
  475.    AddItem(id_InsertL,'InsertL');
  476.    AddItem(id_PadCentre,'PadCentre');
  477.    AddItem(id_PadEnd,'PadEnd');
  478.    AddItem(id_PadFront,'PadFront');
  479.    AddItem(id_RemoveDIC,'RemoveDIC');
  480.    AddItem(id_RemoveSIC,'RemoveSIC');
  481.    AddItem(id_Trim,'Trim');
  482.    AddItem(id_TrimEnd,'TrimEnd');
  483.    AddItem(id_TrimFront,'TrimFront');
  484.    AddItem(id_TrimZero,'TrimZero');
  485.    AddItem(id_FindCmdLine,'FindCmdLine');
  486.    AddItem(id_FindCmdLineAndParse,'FindCmdLineAndParse');
  487.    AddItem(id_FindCmdLineParam,'FindCmdLineParam');
  488.    AddItem(id_AppendStringRes,'AppendStringRes');
  489.    AddItem(id_LoadStringRes,'LoadStringRes');
  490.    AddItem(id_ReadIniKeyword,'ReadIniKeyword');
  491.    AddItem(id_WriteIniKeyword,'WriteIniKeyword');
  492.    AddItem(id_FindIniSectionKeywords,'FindIniSectionKeywords');
  493.    AddItem(id_AddBackSlash,'AddBackSlash');
  494.    AddItem(id_AddFilterDesc,'AddFilterDesc');
  495.    AddItem(id_BuildPathName,'BuildPathName');
  496.    AddItem(id_CreateDirectory,'CreateDirectory');
  497.    AddItem(id_DefaultExtension,'DefaultExtension');
  498.    AddItem(id_DirectoryExists,'DirectoryExists');
  499.    AddItem(id_DriveExists,'DriveExists');
  500.    AddItem(id_ExpandFileName,'ExpandFileName');
  501.    AddItem(id_FileExists,'FileExists');
  502.    AddItem(id_FindCurrentDir,'FindCurrentDir');
  503.    AddItem(id_FindRelPath,'FindRelPath');
  504.    AddItem(id_ForceExtension,'ForceExtension');
  505.    AddItem(id_HasBackSlash,'HasBackSlash');
  506.    AddItem(id_HasDrive,'HasDrive');
  507.    AddItem(id_HasExtension,'HasExtension');
  508.    AddItem(id_HasFileName,'HasFileName');
  509.    AddItem(id_HasDirectory,'HasDirectory');
  510.    AddItem(id_FileSplit,'FileSplit');
  511.    AddItem(id_JustExtension,'JustExtension');
  512.    AddItem(id_JustFileName,'JustFileName');
  513.    AddItem(id_JustName,'JustName');
  514.    AddItem(id_JustDirectory,'JustDirectory');
  515.    AddItem(id_RemoveDirectory,'RemoveDirectory');
  516.    AddItem(id_SameDrive,'SameDrive');
  517.    AddItem(id_SameDirectory,'SameDirectory');
  518.    AddItem(id_SameExtension,'SameExtension');
  519.    AddItem(id_SameFileName,'SameFileName');
  520.    AddItem(id_SameName,'SameName');
  521.    AddItem(id_SetCurDir,'SetCurDir');
  522.    AddItem(id_ChCount,'ChCount');
  523.    AddItem(id_FindBetween2Ch,'FindBetween2Ch');
  524.    AddItem(id_FindFirst,'FindFirst');
  525.    AddItem(id_FindFirstCh,'FindFirstCh');
  526.    AddItem(id_FindLast,'FindLast');
  527.    AddItem(id_FindLastCh,'FindLastCh');
  528.    AddItem(id_FindNext,'FindNext');
  529.    AddItem(id_FindNextCh,'FindNextCh');
  530.    AddItem(id_FindPrev,'FindPrev');
  531.    AddItem(id_FindPrevCh,'FindPrevCh');
  532.    AddItem(id_Grep,'Grep');
  533.    AddItem(id_SubStrCount,'SubStrCount');
  534.    AddItem(id_FirstCharToUpper,'FirstCharToUpper');
  535.    AddItem(id_IsAlphaNumeric,'IsAlphaNumeric');
  536.    AddItem(id_ToLower,'ToLower');
  537.    AddItem(id_ToUpper,'ToUpper');
  538.    AddItem(id_ReplaceAll,'ReplaceAll');
  539.    AddItem(id_ReplaceFirst,'ReplaceFirst');
  540.    AddItem(id_ReplaceLast,'ReplaceLast');
  541.    AddItem(id_ReplaceChAll,'ReplaceChAll');
  542.    AddItem(id_ReplaceChFirst,'ReplaceChFirst');
  543.    AddItem(id_ReplaceChLast,'ReplaceChLast');
  544.    AddItem(id_FirstParseDelim,'FirstParseDelim');
  545.    AddItem(id_NextParseDelim,'NextParseDelim');
  546.    AddItem(id_ParseDelimCount,'ParseDelimCount');
  547.    AddItem(id_ParseDelimToList,'ParseDelimToList');
  548.    AddItem(id_ParseMultiDelimToList,'ParseMultiDelimToList');
  549.    AddItem(id_ParsePosToList,'ParsePosToList');
  550.    FuncLb.ItemIndex := -1;
  551. END;
  552.  
  553. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  554.  
  555. procedure TSCTestBed.FuncLbClick(Sender: TObject);
  556. CONST
  557.    MaxLen = 500;
  558. VAR
  559.    AStr : PChar;
  560.    AnItem : PFunctionRecord;
  561.  
  562.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  563.  
  564.    FUNCTION MatchStr(R : PFunctionRecord) : BOOLEAN; FAR;
  565.    BEGIN
  566.       MatchStr := (SafeStrIComp(AStr,R^.Name) = 0);
  567.    END;
  568.  
  569.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  570.  
  571. begin
  572.    GetMem(AStr,Maxlen);
  573.    StrPCopy(AStr,FuncLb.Items.Strings[FuncLb.ItemIndex]);
  574.    AnItem := TheFuncList.FirstThat(@MatchStr);
  575.    IF AnItem <> NIL THEN
  576.       RunTest(AnItem^.Id);
  577.    FreeMem(AStr,Maxlen);
  578.  
  579. end;
  580.  
  581. { ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  582.  
  583. PROCEDURE TScTestBed.RunTest(fid : WORD);
  584. CONST
  585.    ANullPChar : PChar = NIL;
  586.    APChar : PChar = 'PChar string';
  587.    AStr : STRING = 'Pascal string';
  588.    ANullStr : STRING = '';
  589.    ALong : LONGINT = 99000;
  590.    APath : STRING = 'c:\windows\system.ini';
  591.    AReal : REAL = 21.3;
  592.    AnInteger : INTEGER = -5;
  593.    AWord : WORD = 66;
  594.    ADouble : DOUBLE = 66.4;
  595.    AByte : BYTE = 124;
  596.    AnExt : EXTENDED = 134.456;
  597.  
  598. VAR
  599.    ANullStrObj,AStrObj : TStringClass;
  600.  
  601.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  602.  
  603.    PROCEDURE DoCreate;
  604.    BEGIN
  605.       Writeln('Instantiates an object with null string and zero buffer length');
  606.       Writeln('e.g. AStrObj := TStringClass.Create');
  607.    END;
  608.  
  609.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  610.  
  611.    PROCEDURE DoCreateSize;
  612.    BEGIN
  613.       Writeln('Instantiates an object with a null string but with a buffer');
  614.       Writeln(' size preset to ''ASize'' bytes. Useful for situations ');
  615.       Writeln('where lots of assigns/appends are anticipated.');
  616.       Writeln('e.g. AStrObj := TStringClass.CreateSize(2000)');
  617.    END;
  618.  
  619.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  620.  
  621.    PROCEDURE DoCreateString;
  622.    VAR
  623.       TObj : TStringClass;
  624.    BEGIN
  625.       Writeln('Code:');
  626.       Writeln('TObj := TStringClass.CreateString([AStr,''.'',APChar,''.'',ANullPChar,''.'']);');
  627.       TObj := TStringClass.CreateString([AStr,'.',APChar,'.',ANullPChar,'.']);
  628.       Writeln;
  629.       Writeln('Result:');
  630.       Writeln(TObj.ZString);
  631.       TObj.Free;
  632.    END;
  633.  
  634.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  635.  
  636.    PROCEDURE DoCreateStringNL;
  637.    VAR
  638.       TObj : TStringClass;
  639.    BEGIN
  640.       Writeln('Code:');
  641.       Writeln('TObj := TStringClass.CreateStringNL([AStr]);');
  642.       Writeln('TObj.Append([APChar]);');
  643.       TObj := TStringClass.CreateStringNL([AStr]);
  644.       TObj.Append([APChar]);
  645.       Writeln;
  646.       Writeln('Result:');
  647.       Writeln(TObj.ZString);
  648.       TObj.Free;
  649.    END;
  650.  
  651.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  652.  
  653.    PROCEDURE DoCreateBoolean;
  654.    VAR
  655.       TObj : TStringClass;
  656.    BEGIN
  657.       Writeln('Code:');
  658.       Writeln('TObj := TStringClass.CreateBoolean(TRUE,bt_NoYes);');
  659.       TObj := TStringClass.CreateBoolean(TRUE,bt_NoYes);
  660.       Writeln;
  661.       Writeln('Result:');
  662.       Writeln(TObj.ZString);
  663.       TObj.Free;
  664.    END;
  665.  
  666.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  667.  
  668.    PROCEDURE DoDestroy;
  669.    BEGIN
  670.       Writeln('Disposes the string class object.');
  671.       Writeln('Do not call directly. Use the Free metheod');
  672.    END;
  673.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  674.  
  675.    PROCEDURE DoCopy;
  676.    VAR
  677.       TObj,CObj : TStringClass;
  678.    BEGIN
  679.       Writeln('Code:');
  680.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  681.       Writeln('CObj := TObj.Copy;');
  682.       TObj := TStringClass.CreateString([AStr]);
  683.       CObj := TObj.Copy;
  684.       Writeln;
  685.       Writeln('Result:');
  686.       Writeln('Original string object text = ',TObj.ZString);
  687.       Writeln('Copy string object text     = ',CObj.ZString);
  688.       TObj.Free;
  689.       CObj.Free;
  690.    END;
  691.  
  692.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  693.  
  694.    PROCEDURE DoCopyFrom;
  695.    VAR
  696.       TObj,CObj : TStringClass;
  697.    BEGIN
  698.       Writeln('Code:');
  699.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  700.       Writeln('CObj := TStringClass.Create;');
  701.       Writeln('CObj.CopyFrom(TObj);');
  702.       TObj := TStringClass.CreateString([AStr]);
  703.       CObj := TStringClass.Create;
  704.       CObj.CopyFrom(TObj);
  705.       Writeln;
  706.       Writeln('Result:');
  707.       Writeln('Original string object text = ',TObj.ZString);
  708.       Writeln('Copy string object text     = ',CObj.ZString);
  709.       TObj.Free;
  710.       CObj.Free;
  711.    END;
  712.  
  713.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  714.  
  715.    PROCEDURE DoClear;
  716.    VAR
  717.       TObj : TStringClass;
  718.    BEGIN
  719.       Writeln('Code:');
  720.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  721.       Writeln('TObj.Clear;');
  722.       TObj := TStringClass.CreateString([AStr]);
  723.       Writeln;
  724.       Writeln('Result pre clear :');
  725.       Writeln(TObj.ZString,'(Buffer Size = ',TObj.MaxSize,')');
  726.       TObj.Clear;
  727.       Writeln;
  728.       Writeln('Result post clear :');
  729.       Writeln(TObj.ZString,'(Buffer Size = ',TObj.MaxSize,')');
  730.       Writeln;
  731.       TObj.Free;
  732.    END;
  733.  
  734.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  735.  
  736.    PROCEDURE DoEmpty;
  737.    VAR
  738.       TObj : TStringClass;
  739.    BEGIN
  740.       Writeln('Code:');
  741.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  742.       Writeln('TObj.Empty;');
  743.       TObj := TStringClass.CreateString([AStr]);
  744.       Writeln;
  745.       Writeln('Result pre Empty :');
  746.       Writeln(TObj.ZString,'(Buffer Size = ',TObj.MaxSize,')');
  747.       TObj.Empty;
  748.       Writeln;
  749.       Writeln('Result post Empty :');
  750.       Writeln(TObj.ZString,'(Buffer Size = ',TObj.MaxSize,')');
  751.       Writeln;
  752.       TObj.Free;
  753.    END;
  754.  
  755.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  756.  
  757.    PROCEDURE DoAssign;
  758.    VAR
  759.       TObj : TStringClass;
  760.    BEGIN
  761.       Writeln('Code:');
  762.       Writeln('TObj := TStringClass.Create;');
  763.       Writeln('TObj.Assign([AStr,'' and '',APChar,'' '',ALong]);');
  764.       TObj := TStringClass.Create;
  765.       TObj.Assign([AStr,' and ',APChar,' ',ALong]);
  766.       Writeln;
  767.       Writeln('Result:');
  768.       Writeln(TObj.ZString);
  769.       TObj.Free;
  770.    END;
  771.  
  772.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  773.  
  774.    PROCEDURE DoAssignFrom;
  775.    VAR
  776.       TObj : TStringClass;
  777.    BEGIN
  778.       Writeln('Code:');
  779.       Writeln('TObj := TStringClass.Create;');
  780.       Writeln('TObj.AssignFrom([AStr,'' and '',APChar,'' '',ALong],7);');
  781.       TObj := TStringClass.Create;
  782.       TObj.AssignFrom([AStr,' and ',APChar,' ',ALong],7);
  783.       Writeln;
  784.       Writeln('Result:');
  785.       Writeln(TObj.ZString);
  786.       TObj.Free;
  787.    END;
  788.  
  789.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  790.  
  791.    PROCEDURE DoAssignLen;
  792.    VAR
  793.       TObj : TStringClass;
  794.    BEGIN
  795.       Writeln('Code:');
  796.       Writeln('TObj := TStringClass.Create;');
  797.       Writeln('TObj.AssignLen([AStr,'' and '',APChar,'' '',ALong],9);');
  798.       TObj := TStringClass.Create;
  799.       TObj.AssignLen([AStr,' and ',APChar,' ',ALong],9);
  800.       Writeln;
  801.       Writeln('Result:');
  802.       Writeln(TObj.ZString);
  803.       TObj.Free;
  804.    END;
  805.  
  806.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  807.  
  808.    PROCEDURE DoAssignMid;
  809.    VAR
  810.       TObj : TStringClass;
  811.    BEGIN
  812.       Writeln('Code:');
  813.       Writeln('TObj := TStringClass.Create;');
  814.       Writeln('TObj.AssignMid([AStr,'' and '',APChar,'' '',ALong],7,5);');
  815.       TObj := TStringClass.Create;
  816.       TObj.AssignMid([AStr,' and ',APChar,' ',ALong],7,5);
  817.       Writeln;
  818.       Writeln('Result:');
  819.       Writeln(TObj.ZString);
  820.       TObj.Free;
  821.    END;
  822.  
  823.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  824.  
  825.    PROCEDURE DoAssignNL;
  826.    VAR
  827.       TObj : TStringClass;
  828.    BEGIN
  829.       Writeln('Code:');
  830.       Writeln('TObj := TStringClass.Create;');
  831.       Writeln('TObj.AssignNL([AStr,'' and '',APChar,'' '',ALong]);');
  832.       Writeln('TObj.Append([AWord]);');
  833.       TObj := TStringClass.Create;
  834.       TObj.AssignNL([AStr,' and ',APChar,' ',ALong]);
  835.       TObj.Append([AWord]);
  836.       Writeln;
  837.       Writeln('Result:');
  838.       Writeln(TObj.ZString);
  839.       TObj.Free;
  840.    END;
  841.  
  842.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  843.  
  844.    PROCEDURE DoAssignPad;
  845.    VAR
  846.       TObj : TStringClass;
  847.    BEGIN
  848.       Writeln('Code:');
  849.       Writeln('TObj := TStringClass.Create;');
  850.       Writeln('TObj.AssignPad([AStr],15,''x'');');
  851.       TObj := TStringClass.Create;
  852.       TObj.AssignPad([AStr],15,'x');
  853.       Writeln;
  854.       Writeln('Result:');
  855.       Writeln(TObj.ZString);
  856.       TObj.Free;
  857.    END;
  858.  
  859.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  860.  
  861.    PROCEDURE DoAssignRight;
  862.    VAR
  863.       TObj : TStringClass;
  864.    BEGIN
  865.       Writeln('Code:');
  866.       Writeln('TObj := TStringClass.Create;');
  867.       Writeln('TObj.AssignRight([AStr],3);');
  868.       TObj := TStringClass.Create;
  869.       TObj.AssignRight([AStr],3);
  870.       Writeln;
  871.       Writeln('Result:');
  872.       Writeln(TObj.ZString);
  873.       TObj.Free;
  874.    END;
  875.  
  876.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  877.  
  878.    PROCEDURE DoAssignTrim;
  879.    VAR
  880.       TObj : TStringClass;
  881.    BEGIN
  882.       Writeln('Code:');
  883.       Writeln('TObj := TStringClass.Create;');
  884.       Writeln('TObj.AssignTrim([''    '',AStr,''   '']);');
  885.       TObj := TStringClass.Create;
  886.       TObj.AssignTrim(['    ',AStr,'   ']);
  887.       Writeln;
  888.       Writeln('Result:');
  889.       Writeln(TObj.ZString);
  890.       TObj.Free;
  891.    END;
  892.  
  893.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  894.  
  895.    PROCEDURE DoAppend;
  896.    VAR
  897.       TObj : TStringClass;
  898.    BEGIN
  899.       Writeln('Code:');
  900.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  901.       Writeln('TObj.Append([APChar,'' '',ADouble]);');
  902.       TObj := TStringClass.CreateString([AStr]);
  903.       TObj.Append([APChar,' ',ADouble]);
  904.       Writeln;
  905.       Writeln('Result:');
  906.       Writeln;
  907.       Writeln(TObj.ZString);
  908.       TObj.Free;
  909.    END;
  910.  
  911.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  912.  
  913.    PROCEDURE DoAppendBoolean;
  914.    VAR
  915.       TObj : TStringClass;
  916.    BEGIN
  917.       Writeln('Code:');
  918.       Writeln('TObj := TStringClass.CreateString([AStr,'' = '']);');
  919.       Writeln('TObj.AppendBoolean(FALSE,bt_FalseTrue);');
  920.       TObj := TStringClass.CreateString([AStr,' = ']);
  921.       TObj.AppendBoolean(FALSE,bt_FalseTrue);
  922.       Writeln;
  923.       Writeln('Result:');
  924.       Writeln(TObj.ZString);
  925.       TObj.Free;
  926.    END;
  927.  
  928.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  929.  
  930.    PROCEDURE DoAppendByte;
  931.    VAR
  932.       TObj : TStringClass;
  933.    BEGIN
  934.       Writeln('Code:');
  935.       Writeln('TObj := TStringClass.CreateString([AStr,'' = '']);');
  936.       Writeln('TObj.AppendByte(AByte);');
  937.       TObj := TStringClass.CreateString([AStr,' = ']);
  938.       TObj.AppendByte(AByte);
  939.       Writeln;
  940.       Writeln('Result:');
  941.       Writeln(TObj.ZString);
  942.       TObj.Free;
  943.    END;
  944.  
  945.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  946.  
  947.    PROCEDURE DoAppendCh;
  948.    VAR
  949.       TObj : TStringClass;
  950.    BEGIN
  951.       Writeln('Code:');
  952.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  953.       Writeln('TObj.AppendCh(''*'');');
  954.       TObj := TStringClass.CreateString([AStr]);
  955.       TObj.AppendCh('*');
  956.       Writeln;
  957.       Writeln('Result:');
  958.       Writeln(TObj.ZString);
  959.       TObj.Free;
  960.    END;
  961.  
  962.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  963.  
  964.    PROCEDURE DoAppendDIC;
  965.    VAR
  966.       TObj : TStringClass;
  967.    BEGIN
  968.       Writeln('Code:');
  969.       Writeln('TObj := TStringClass.CreateString([''Call me '']);');
  970.       Writeln('TObj.AppendDIC([''Mr Tibbs'']);');
  971.       TObj := TStringClass.CreateString(['Call me ']);
  972.       TObj.AppendDIC(['Mr Tibbs']);
  973.       Writeln;
  974.       Writeln('Result:');
  975.       Writeln(TObj.ZString);
  976.       TObj.Free;
  977.    END;
  978.  
  979.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  980.  
  981.    PROCEDURE DoAppendDouble;
  982.    VAR
  983.       TObj : TStringClass;
  984.    BEGIN
  985.       Writeln('Code:');
  986.       Writeln('TObj := TStringClass.CreateString([''Value =  '']);');
  987.       Writeln('TObj.AppendDouble(ADouble,10,3);');
  988.       TObj := TStringClass.CreateString(['Value =  ']);
  989.       TObj.AppendDouble(ADouble,10,3);
  990.       Writeln;
  991.       Writeln('Result:');
  992.       Writeln(TObj.ZString);
  993.       TObj.Free;
  994.    END;
  995.  
  996.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  997.  
  998.    PROCEDURE DoAppendDoubleTrim;
  999.    VAR
  1000.       TObj : TStringClass;
  1001.    BEGIN
  1002.       Writeln('Code:');
  1003.       Writeln('TObj := TStringClass.CreateString([''Value =  '']);');
  1004.       Writeln('TObj.AppendDoubleTrim(ADouble);');
  1005.       TObj := TStringClass.CreateString(['Value =  ']);
  1006.       TObj.AppendDoubleTrim(ADouble);
  1007.       Writeln;
  1008.       Writeln('Result:');
  1009.       Writeln(TObj.ZString);
  1010.       TObj.Free;
  1011.    END;
  1012.  
  1013.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1014.  
  1015.    PROCEDURE DoAppendExt;
  1016.    VAR
  1017.       TObj : TStringClass;
  1018.    BEGIN
  1019.       Writeln('Code:');
  1020.       Writeln('TObj := TStringClass.CreateString([''Value =  '']);');
  1021.       Writeln('TObj.AppendExt(AnExt,10,3);');
  1022.       TObj := TStringClass.CreateString(['Value =  ']);
  1023.       TObj.AppendExt(AnExt,10,3);
  1024.       Writeln;
  1025.       Writeln('Result:');
  1026.       Writeln(TObj.ZString);
  1027.       TObj.Free;
  1028.    END;
  1029.  
  1030.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1031.  
  1032.    PROCEDURE DoAppendExtTrim;
  1033.    VAR
  1034.       TObj : TStringClass;
  1035.    BEGIN
  1036.       Writeln('Code:');
  1037.       Writeln('TObj := TStringClass.CreateString([''Value =  '']);');
  1038.       Writeln('TObj.AppendExtTrim(AnExt);');
  1039.       TObj := TStringClass.CreateString(['Value =  ']);
  1040.       TObj.AppendExtTrim(AnExt);
  1041.       Writeln;
  1042.       Writeln('Result:');
  1043.       Writeln(TObj.ZString);
  1044.       TObj.Free;
  1045.    END;
  1046.  
  1047.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1048.  
  1049.    PROCEDURE DoAppendLen;
  1050.    VAR
  1051.       TObj : TStringClass;
  1052.    BEGIN
  1053.       Writeln('Code:');
  1054.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1055.       Writeln('TObj.AppendLen([APChar],4);');
  1056.       TObj := TStringClass.CreateString([AStr]);
  1057.       TObj.AppendLen([APChar],4);
  1058.       Writeln;
  1059.       Writeln('Result:');
  1060.       Writeln(TObj.ZString);
  1061.       TObj.Free;
  1062.    END;
  1063.  
  1064.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1065.  
  1066.    PROCEDURE DoAppendLong;
  1067.    VAR
  1068.       TObj : TStringClass;
  1069.    BEGIN
  1070.       Writeln('Code:');
  1071.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1072.       Writeln('TObj.AppendLong(ALong);');
  1073.       TObj := TStringClass.CreateString([AStr]);
  1074.       TObj.AppendLong(ALong);
  1075.       Writeln;
  1076.       Writeln('Result:');
  1077.       Writeln(TObj.ZString);
  1078.       TObj.Free;
  1079.    END;
  1080.  
  1081.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1082.  
  1083.    PROCEDURE DoAppendMid;
  1084.    VAR
  1085.       TObj : TStringClass;
  1086.    BEGIN
  1087.       Writeln('Code:');
  1088.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1089.       Writeln('TObj.AppendMid([APChar],3,2);');
  1090.       TObj := TStringClass.CreateString([AStr]);
  1091.       TObj.AppendMid([APChar],3,2);
  1092.       Writeln;
  1093.       Writeln('Result:');
  1094.       Writeln(TObj.ZString);
  1095.       TObj.Free;
  1096.    END;
  1097.  
  1098.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1099.  
  1100.    PROCEDURE DoAppendNL;
  1101.    VAR
  1102.       TObj : TStringClass;
  1103.    BEGIN
  1104.       Writeln('Code:');
  1105.       Writeln('TObj := TStringClass.Create;');
  1106.       Writeln('TObj.AppendNL([''1st line'']);');
  1107.       Writeln('TObj.Append([''2nd line'']);');
  1108.       TObj := TStringClass.Create;
  1109.       TObj.AppendNL(['1st line']);
  1110.       TObj.Append(['2nd line']);
  1111.       Writeln;
  1112.       Writeln('Result:');
  1113.       Writeln(TObj.ZString);
  1114.       TObj.Free;
  1115.    END;
  1116.  
  1117.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1118.  
  1119.    PROCEDURE DoAppendPad;
  1120.    VAR
  1121.       TObj : TStringClass;
  1122.    BEGIN
  1123.       Writeln('Code:');
  1124.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1125.       Writeln('TObj.AppendPad([APChar],30,''?'');');
  1126.       TObj := TStringClass.CreateString([AStr]);
  1127.       TObj.AppendPad([APChar],30,'?');
  1128.       Writeln;
  1129.       Writeln('Result:');
  1130.       Writeln(TObj.ZString);
  1131.       TObj.Free;
  1132.    END;
  1133.  
  1134.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1135.  
  1136.    PROCEDURE DoAppendPtr;
  1137.    VAR
  1138.       TObj : TStringClass;
  1139.    BEGIN
  1140.       Writeln('Code:');
  1141.       Writeln('TObj := TStringClass.CreateString([''ALong Pointer = '']);');
  1142.       Writeln('TObj.AppendPtr(@ALong);');
  1143.       TObj := TStringClass.CreateString(['ALong Pointer = ']);
  1144.       TObj.AppendPtr(@ALong);
  1145.       Writeln;
  1146.       Writeln('Result:');
  1147.       Writeln(TObj.ZString);
  1148.       TObj.Free;
  1149.    END;
  1150.  
  1151.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1152.  
  1153.    PROCEDURE DoAppendReal;
  1154.    VAR
  1155.       TObj : TStringClass;
  1156.    BEGIN
  1157.       Writeln('Code:');
  1158.       Writeln('TObj := TStringClass.CreateString([''AReal = '']);');
  1159.       Writeln('TObj.AppendReal(AReal,10,2);');
  1160.       TObj := TStringClass.CreateString(['AReal = ']);
  1161.       TObj.AppendReal(AReal,10,2);
  1162.       Writeln;
  1163.       Writeln('Result:');
  1164.       Writeln(TObj.ZString);
  1165.       TObj.Free;
  1166.    END;
  1167.  
  1168.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1169.  
  1170.    PROCEDURE DoAppendRight;
  1171.    VAR
  1172.       TObj : TStringClass;
  1173.    BEGIN
  1174.       Writeln('Code:');
  1175.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1176.       Writeln('TObj.AppendRight([APChar],3);');
  1177.       TObj := TStringClass.CreateString([AStr]);
  1178.       TObj.AppendRight([APChar],3);
  1179.       Writeln;
  1180.       Writeln('Result:');
  1181.       Writeln(TObj.ZString);
  1182.       TObj.Free;
  1183.    END;
  1184.  
  1185.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1186.  
  1187.    PROCEDURE DoAppendSIC;
  1188.    VAR
  1189.       TObj : TStringClass;
  1190.    BEGIN
  1191.       Writeln('Code:');
  1192.       Writeln('TObj := TStringClass.CreateString([''Call me '']);');
  1193.       Writeln('TObj.AppendSIC([''Mr Tibbs'']);');
  1194.       TObj := TStringClass.CreateString(['Call me ']);
  1195.       TObj.AppendSIC(['Mr Tibbs']);
  1196.       Writeln;
  1197.       Writeln('Result:');
  1198.       Writeln(TObj.ZString);
  1199.       TObj.Free;
  1200.    END;
  1201.  
  1202.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1203.  
  1204.    PROCEDURE DoAppendTrim;
  1205.    VAR
  1206.       TObj : TStringClass;
  1207.    BEGIN
  1208.       Writeln('Code:');
  1209.       Writeln('TObj := TStringClass.CreateString([''Call me '']);');
  1210.       Writeln('TObj.AppendTrim([''       Mr Tibbs        '']);');
  1211.       TObj := TStringClass.CreateString(['Call me ']);
  1212.       TObj.AppendTrim(['       Mr Tibbs        ']);
  1213.       Writeln;
  1214.       Writeln('Result:');
  1215.       Writeln(TObj.ZString);
  1216.       TObj.Free;
  1217.    END;
  1218.  
  1219.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1220.  
  1221.    PROCEDURE DoAppendWithTab;
  1222.    VAR
  1223.       TObj : TStringClass;
  1224.    BEGIN
  1225.       Writeln('Code:');
  1226.       Writeln('TObj := TStringClass.Create;');
  1227.       Writeln('TObj.AppendWithTab([''First'']);');
  1228.       Writeln('TObj.Append([''Second'']);');
  1229.       TObj := TStringClass.Create;
  1230.       TObj.AppendWithTab(['First']);
  1231.       TObj.Append(['Second']);
  1232.       Writeln;
  1233.       Writeln('Result:');
  1234.       Writeln(TObj.ZString);
  1235.       TObj.Free;
  1236.    END;
  1237.  
  1238.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1239.  
  1240.    PROCEDURE DoNLAppend;
  1241.    VAR
  1242.       TObj : TStringClass;
  1243.    BEGIN
  1244.       Writeln('Code:');
  1245.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1246.       Writeln('TObj.NLAppend([APChar]);');
  1247.       TObj := TStringClass.CreateString([AStr]);
  1248.       TObj.NLAppend([APChar]);
  1249.       Writeln;
  1250.       Writeln('Result:');
  1251.       Writeln(TObj.ZString);
  1252.       TObj.Free;
  1253.    END;
  1254.  
  1255.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1256.  
  1257.    PROCEDURE DoPrepend;
  1258.    VAR
  1259.       TObj : TStringClass;
  1260.    BEGIN
  1261.       Writeln('Code:');
  1262.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1263.       Writeln('TObj.Prepend([APChar]);');
  1264.       TObj := TStringClass.CreateString([AStr]);
  1265.       TObj.Prepend([APChar]);
  1266.       Writeln;
  1267.       Writeln('Result:');
  1268.       Writeln(TObj.ZString);
  1269.       TObj.Free;
  1270.    END;
  1271.  
  1272.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1273.  
  1274.    PROCEDURE DoFirstNonSpaceCh;
  1275.    VAR
  1276.       TObj : TStringClass;
  1277.       w : WORD;
  1278.       ACh : CHAR;
  1279.    BEGIN
  1280.       Writeln('Code:');
  1281.       Writeln('TObj := TStringClass.CreateString([''      '',AStr]);');
  1282.       Writeln('w := TObj.FirstNonSpaceCh(ACh);');
  1283.       TObj := TStringClass.CreateString(['      ',AStr]);
  1284.       w := TObj.FirstNonSpaceCh(ACh);
  1285.       Writeln;
  1286.       Writeln('Result:');
  1287.       Writeln(TObj.ZString);
  1288.       Writeln('First non space char at base zero position ',w,' and is a ',ACh,' character');
  1289.       TObj.Free;
  1290.    END;
  1291.  
  1292.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1293.  
  1294.    PROCEDURE DoHasCh;
  1295.    VAR
  1296.       TObj : TStringClass;
  1297.       w : WORD;
  1298.       ACh : CHAR;
  1299.       b : boolean;
  1300.    BEGIN
  1301.       Writeln('Code:');
  1302.       Writeln('ACh := ''c'';');
  1303.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1304.       Writeln('b := TObj.HasCh(ACh,w);');
  1305.       ACh := 'c';
  1306.       TObj := TStringClass.CreateString([AStr]);
  1307.       b := TObj.HasCh(ACh,w);
  1308.       Writeln;
  1309.       Writeln('Result:');
  1310.       Writeln(TObj.ZString);
  1311.       IF b THEN
  1312.       BEGIN
  1313.          Write('Character ',ACh,' is found within the string');
  1314.          Writeln(' at position ',w);
  1315.       END
  1316.       ELSE
  1317.          Writeln('Character ',ACh,' is NOT found within the string');
  1318.       TObj.Free;
  1319.    END;
  1320.  
  1321.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1322.  
  1323.    PROCEDURE DoIsCh;
  1324.    VAR
  1325.       TObj : TStringClass;
  1326.       w : WORD;
  1327.       ACh : CHAR;
  1328.       b : boolean;
  1329.    BEGIN
  1330.       Writeln('Code:');
  1331.       Writeln('ACh := ''c'';');
  1332.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1333.       Writeln('b := TObj.IsCh(3,ACh);');
  1334.       ACh := 'c';
  1335.       TObj := TStringClass.CreateString([AStr]);
  1336.       b := TObj.IsCh(3,ACh);
  1337.       Writeln;
  1338.       Writeln('Result:');
  1339.       Writeln(TObj.ZString);
  1340.       IF b THEN
  1341.       BEGIN
  1342.          Writeln('Character ',ACh,' is found at position 3');
  1343.       END
  1344.       ELSE
  1345.          Writeln('Character ',ACh,' is NOT found at position 3');
  1346.       TObj.Free;
  1347.    END;
  1348.  
  1349.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1350.  
  1351.    PROCEDURE DoFromRGB;
  1352.    VAR
  1353.       TObj : TStringClass;
  1354.       C : TColorRef;
  1355.    BEGIN
  1356.       Writeln('Code:');
  1357.       Writeln('TObj := TStringClass.Create;');
  1358.       Writeln('C := RGB(255,255,0);');
  1359.       Writeln('TObj.FromRGB(C);');
  1360.       TObj := TStringClass.Create;
  1361.       C := RGB(255,255,0);
  1362.       TObj.FromRGB(C);
  1363.       Writeln;
  1364.       Writeln('Result:');
  1365.       Writeln(TObj.ZString);
  1366.       TObj.Free;
  1367.    END;
  1368.  
  1369.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1370.  
  1371.    PROCEDURE DoFindCmdLine;
  1372.    VAR
  1373.       TObj : TStringClass;
  1374.    BEGIN
  1375.       Writeln('Code:');
  1376.       Writeln('TObj := TStringClass.Create;');
  1377.       Writeln('TObj.FindCmdLine;');
  1378.       TObj := TStringClass.Create;
  1379.       TObj.FindCmdLine;
  1380.       Writeln;
  1381.       Writeln('Result:');
  1382.       Writeln(TObj.ZString);
  1383.       TObj.Free;
  1384.    END;
  1385.  
  1386.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1387.  
  1388.    PROCEDURE DoFindRelPath;
  1389.    VAR
  1390.       TObj : TStringClass;
  1391.    BEGIN
  1392.       Writeln('Code:');
  1393.       Writeln('TObj := TStringClass.Create;');
  1394.       Writeln('TObj.FindRelPath([''c:\windows''],[''c:\test\data'']);');
  1395.       TObj := TStringClass.Create;
  1396.       TObj.FindRelPath(['c:\windows'],['c:\test\data']);
  1397.       Writeln;
  1398.       Writeln('Result:');
  1399.       Writeln(TObj.ZString);
  1400.       TObj.Free;
  1401.    END;
  1402.  
  1403.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1404.  
  1405.    PROCEDURE DoJustExtension;
  1406.    VAR
  1407.       TObj : TStringClass;
  1408.    BEGIN
  1409.       Writeln('Code:');
  1410.       Writeln('TObj := TStringClass.Create;');
  1411.       Writeln('TObj.JustExtension([APath]);');
  1412.       TObj := TStringClass.Create;
  1413.       TObj.JustExtension([APath]);
  1414.       Writeln;
  1415.       Writeln('Result:');
  1416.       Writeln(TObj.ZString);
  1417.       TObj.Free;
  1418.    END;
  1419.  
  1420.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1421.  
  1422.    PROCEDURE DoJustFileName;
  1423.    VAR
  1424.       TObj : TStringClass;
  1425.    BEGIN
  1426.       Writeln('Code:');
  1427.       Writeln('TObj := TStringClass.Create;');
  1428.       Writeln('TObj.JustFileName([APath]);');
  1429.       TObj := TStringClass.Create;
  1430.       TObj.JustFileName([APath]);
  1431.       Writeln;
  1432.       Writeln('Result:');
  1433.       Writeln(TObj.ZString);
  1434.       TObj.Free;
  1435.    END;
  1436.  
  1437.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1438.  
  1439.    PROCEDURE DoJustName;
  1440.    VAR
  1441.       TObj : TStringClass;
  1442.    BEGIN
  1443.       Writeln('Code:');
  1444.       Writeln('TObj := TStringClass.Create;');
  1445.       Writeln('TObj.JustName([APath]);');
  1446.       TObj := TStringClass.Create;
  1447.       TObj.JustName([APath]);
  1448.       Writeln;
  1449.       Writeln('Result:');
  1450.       Writeln(TObj.ZString);
  1451.       TObj.Free;
  1452.    END;
  1453.  
  1454.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1455.  
  1456.    PROCEDURE DoJustDirectory;
  1457.    VAR
  1458.       TObj : TStringClass;
  1459.    BEGIN
  1460.       Writeln('Code:');
  1461.       Writeln('TObj := TStringClass.Create;');
  1462.       Writeln('TObj.JustDirectory([APath]);');
  1463.       Writeln('TObj.JustDirectory([''c:\windows'']);');
  1464.       TObj := TStringClass.Create;
  1465.       TObj.JustDirectory([APath]);
  1466.       Writeln;
  1467.       Writeln('Result:');
  1468.       Writeln(TObj.ZString);
  1469.       TObj.JustDirectory(['c:\windows']);
  1470.       Writeln(TObj.ZString);
  1471.       TObj.Free;
  1472.    END;
  1473.  
  1474.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1475.  
  1476.    PROCEDURE DoReplaceAll;
  1477.    VAR
  1478.       TObj : TStringClass;
  1479.    BEGIN
  1480.       Writeln('Code:');
  1481.       Writeln('TObj := TStringClass.CreateString([AStr,'' '',APChar]);');
  1482.       Writeln('TObj.ReplaceAll([''string''],[''text'']);');
  1483.       TObj := TStringClass.CreateString([AStr,' ',APChar]);
  1484.       TObj.ReplaceAll(['string'],['text']);
  1485.       Writeln;
  1486.       Writeln('Result:');
  1487.       Writeln(TObj.ZString);
  1488.       TObj.Free;
  1489.    END;
  1490.  
  1491.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1492.  
  1493.    PROCEDURE DoDelete;
  1494.    VAR
  1495.       TObj : TStringClass;
  1496.    BEGIN
  1497.       Writeln('Code:');
  1498.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1499.       Writeln('TObj.Delete(2,3);');
  1500.       TObj := TStringClass.CreateString([AStr]);
  1501.       TObj.Delete(2,3);
  1502.       Writeln;
  1503.       Writeln('Result:');
  1504.       Writeln(TObj.ZString);
  1505.       TObj.Free;
  1506.    END;
  1507.  
  1508.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1509.  
  1510.    PROCEDURE DoDeleteFrom;
  1511.    VAR
  1512.       TObj : TStringClass;
  1513.    BEGIN
  1514.       Writeln('Code:');
  1515.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1516.       Writeln('TObj.DeleteFrom(2);');
  1517.       TObj := TStringClass.CreateString([AStr]);
  1518.       TObj.DeleteFrom(2);
  1519.       Writeln;
  1520.       Writeln('Result:');
  1521.       Writeln(TObj.ZString);
  1522.       TObj.Free;
  1523.    END;
  1524.  
  1525.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1526.  
  1527.    PROCEDURE DoParseDelimToList;
  1528.    VAR
  1529.       TObj : TStringClass;
  1530.       AList : TObjectContainer;
  1531.  
  1532.       { ++++++++++++++++++++++++++++++++++++++++++++++ }
  1533.  
  1534.       PROCEDURE WrSub(S : TStringClass); FAR;
  1535.       BEGIN
  1536.          IF S.Length = 0 THEN
  1537.             Writeln('<null>')
  1538.          ELSE
  1539.             Writeln(S.ZString);
  1540.       END;
  1541.  
  1542.       { ++++++++++++++++++++++++++++++++++++++++++++++ }
  1543.  
  1544.    BEGIN
  1545.       Writeln('Code:');
  1546.       Writeln('AList := TObjectContainer.Create;');
  1547.       Writeln('AList.Capacity := 100;');
  1548.       Writeln('TObj := TStringClass.CreateString([''xxx,yyy,zzzz,wwww,,qqqq,rrrr'']);');
  1549.       Writeln('TObj.ParseDelimToList('','',delim_None,AList);');
  1550.       Writeln('AList.ForEach(@WrSub);');
  1551.       AList := TObjectContainer.Create;
  1552.       AList.Capacity := 100;
  1553.       TObj := TStringClass.CreateString(['xxx,yyy,zzzz,wwww,,qqqq,rrrr']);
  1554.       TObj.ParseDelimToList(',',delim_None,AList);
  1555.       Writeln;
  1556.       Writeln('Result:');
  1557.       Writeln(TObj.ZString);
  1558.       Writeln('Parsed sub strings ...');
  1559.       AList.ForEach(@WrSub);
  1560.       TObj.Free;
  1561.       AList.Free;
  1562.    END;
  1563.  
  1564.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1565.  
  1566.    PROCEDURE DoParseMultiDelimToList;
  1567.    VAR
  1568.       PartObj,TObj : TStringClass;
  1569.       AList : TObjectContainer;
  1570.       I : LONGINT;
  1571.  
  1572.       { ++++++++++++++++++++++++++++++++++++++++++++++ }
  1573.  
  1574.       PROCEDURE WrSub(S : TStringClass); FAR;
  1575.       BEGIN
  1576.          IF S.Length = 0 THEN
  1577.             Writeln('<null>')
  1578.          ELSE
  1579.             Writeln(S.ZString);
  1580.       END;
  1581.  
  1582.       { ++++++++++++++++++++++++++++++++++++++++++++++ }
  1583.  
  1584.    BEGIN
  1585.       Writeln('Code:');
  1586.       Writeln('AList := TObjectContainer.Create;');
  1587.       Writeln('AList.Capacity := 100;');
  1588.       Writeln('AList.ForEach(@WrSub);');
  1589.       Writeln('TObj := TStringClass.CreateString([''>QFADS 14:30:30 - 14:45:00  95/11/01'']);');
  1590.       Writeln('TObj.ParseMultiDelimToList(['' - '','' '',''>QFADS'','':'',''/''],delim_ExcNull,AList');
  1591.       AList := TObjectContainer.Create;
  1592.       AList.Capacity := 100;
  1593.       TObj := TStringClass.CreateString(['>QFADS 14:30:30 - 14:45:00  95/11/01']);
  1594.       TObj.ParseMultiDelimToList([' - ',' ','>QFADS',':','/'],delim_ExcNull,AList);
  1595.       Writeln;
  1596.       Writeln('Result:');
  1597.       Writeln(TObj.ZString);
  1598.       Writeln('Parsed sub strings ...');
  1599.       AList.ForEach(@WrSub);
  1600.       { another way of doing the above is as follows .... }
  1601.       (*
  1602.       FOR I := 0 TO AList.Count-1 DO
  1603.       BEGIN
  1604.          PartObj := TStringClass(AList.Items[I]);
  1605.          Writeln(PartObj.ZString);
  1606.       END;
  1607.       *)
  1608.       TObj.Free;
  1609.       AList.Free;
  1610.    END;
  1611.  
  1612.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1613.  
  1614.    PROCEDURE DoDirectoryExists;
  1615.    VAR
  1616.       TObj : TStringClass;
  1617.    BEGIN
  1618.       Writeln('Code:');
  1619.       Writeln('TObj := TStringClass.CreateString([APath]);');
  1620.       Writeln('B := TObj.DirectoryExists;');
  1621.       TObj := TStringClass.CreateString([APath]);
  1622.       Writeln;
  1623.       Writeln('Result:');
  1624.       Writeln(TObj.ZString);
  1625.       Write('Directory ');
  1626.       IF TObj.DirectoryExists THEN
  1627.          Writeln('exists')
  1628.       ELSE
  1629.          Writeln('does not exist');
  1630.       TObj.Free;
  1631.    END;
  1632.  
  1633.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1634.  
  1635.    PROCEDURE DoFindCurrentDir;
  1636.    VAR
  1637.       TObj : TStringClass;
  1638.    BEGIN
  1639.       Writeln('Code:');
  1640.       Writeln('TObj := TStringClass.Create;');
  1641.       Writeln('TObj.FindCurrentDir;');
  1642.       TObj := TStringClass.Create;
  1643.       TObj.FindCurrentDir;
  1644.       Writeln;
  1645.       Writeln('Result:');
  1646.       Writeln(TObj.ZString);
  1647.       TObj.Free;
  1648.    END;
  1649.  
  1650.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1651.  
  1652.    PROCEDURE DoFileExists;
  1653.    VAR
  1654.       TObj : TStringClass;
  1655.    BEGIN
  1656.       Writeln('Code:');
  1657.       Writeln('TObj := TStringClass.CreateString([APath]);');
  1658.       TObj := TStringClass.CreateString([APath]);
  1659.       Writeln;
  1660.       Writeln('Result:');
  1661.       Writeln(TObj.ZString);
  1662.       Write('File ');
  1663.       IF TObj.FileExists THEN
  1664.          Writeln('exists')
  1665.       ELSE
  1666.          Writeln('does not exist');
  1667.       TObj.Free;
  1668.    END;
  1669.  
  1670.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1671.  
  1672.    PROCEDURE DoFileSplit;
  1673.    VAR
  1674.       TObj,DObj,NObj,EObj : TStringClass;
  1675.    BEGIN
  1676.       Writeln('Code:');
  1677.       Writeln('DObj := TStringClass.Create;');
  1678.       Writeln('NObj := TStringClass.Create;');
  1679.       Writeln('EObj := TStringClass.Create;');
  1680.       Writeln('TObj := TStringClass.CreateString([APath]);');
  1681.       Writeln('TObj.FileSplit(DObj,NObj,EObj);');
  1682.       DObj := TStringClass.Create;
  1683.       NObj := TStringClass.Create;
  1684.       EObj := TStringClass.Create;
  1685.       TObj := TStringClass.CreateString([APath]);
  1686.       TObj.FileSplit(DObj,NObj,EObj);
  1687.       Writeln;
  1688.       Writeln('Result:');
  1689.       Writeln(TObj.ZString);
  1690.       Writeln(DObj.ZString);
  1691.       Writeln(NObj.ZString);
  1692.       Writeln(EObj.ZString);
  1693.       TObj.Free;
  1694.       DObj.Free;
  1695.       NObj.Free;
  1696.       EObj.Free;
  1697.    END;
  1698.  
  1699.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1700.  
  1701.    PROCEDURE DoGrep;
  1702.    VAR
  1703.       TObj : TStringClass;
  1704.       AList : TWordContainer;
  1705.       E : LONGINT;
  1706.    BEGIN
  1707.       TObj := TStringClass.CreateString([APath]);
  1708.       Writeln;
  1709.       Writeln('Result:');
  1710.       Writeln(TObj.ZString);
  1711.       Writeln('Grep locations:');
  1712.       AList := TWordContainer.Create;
  1713.       AList.Capacity := 10;
  1714.       IF TObj.Grep(['in'],AList) > 0 THEN
  1715.       BEGIN
  1716.          FOR E := 0 TO AList.Count-1 DO
  1717.             WRITELN('   ',AList.Items[E]);
  1718.       END
  1719.       ELSE
  1720.          Writeln('< none>');
  1721.       AList.RemoveAll;
  1722.       IF TObj.Grep(['s?'],AList) > 0 THEN
  1723.       BEGIN
  1724.          FOR E := 0 TO AList.Count-1 DO
  1725.             WRITELN('   ',AList.Items[E]);
  1726.       END
  1727.       ELSE
  1728.          Writeln('< none>');
  1729.       TObj.Free;
  1730.       AList.Free;
  1731.    END;
  1732.  
  1733.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1734.  
  1735.    PROCEDURE DoAddFilterDesc;
  1736.    VAR
  1737.       TObj : TStringClass;
  1738.    BEGIN
  1739.       Writeln('TObj := TStringClass.Create;');
  1740.       Writeln('TObj.AddFilterDesc([''Pascal source files''],[''PAS'']);');
  1741.       Writeln('TObj.AddFilterDesc([''C++ source files''],[''CPP'']);');
  1742.       Writeln;
  1743.       Writeln('Result : ');
  1744.       Writeln;
  1745.       TObj := TStringClass.Create;
  1746.       TObj.AddFilterDesc(['Pascal source files'],['PAS']);
  1747.       TObj.AddFilterDesc(['C++ source files'],['CPP']);
  1748.       Writeln(TObj.ZString);
  1749.       TObj.Free;
  1750.    END;
  1751.  
  1752.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1753.  
  1754.    PROCEDURE DoAddBackSlash;
  1755.    VAR
  1756.       TObj : TStringClass;
  1757.    BEGIN
  1758.       Writeln('TObj := TStringClass.CreateString([APath]);');
  1759.       Writeln('TObj.AddBackSlash;');
  1760.       Writeln;
  1761.       Writeln('Result : ');
  1762.       Writeln;
  1763.       TObj := TStringClass.CreateString([APath]);
  1764.       TObj.AddBackSlash;
  1765.       Writeln(TObj.ZString);
  1766.       TObj.Free;
  1767.    END;
  1768.  
  1769.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1770.  
  1771.    PROCEDURE DoAnsiCompareStr;
  1772.    VAR
  1773.       TObj : TStringClass;
  1774.       C : INTEGER;
  1775.    BEGIN
  1776.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1777.       Writeln('TObj.ToUpper;');
  1778.       Writeln('C := TObj.AnsiCompareStr(AStr);');
  1779.       Writeln;
  1780.       Writeln('Result : ');
  1781.       Writeln;
  1782.       TObj := TStringClass.CreateString([AStr]);
  1783.       TObj.ToUpper;
  1784.       C := TObj.AnsiCompareStr(AStr);
  1785.       Writeln(TObj.ZString,' : ',AStr,' : ',C);
  1786.       TObj.Free;
  1787.    END;
  1788.  
  1789.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1790.  
  1791.    PROCEDURE DoAnsiCompareText;
  1792.    VAR
  1793.       TObj : TStringClass;
  1794.       C : INTEGER;
  1795.    BEGIN
  1796.       Writeln('TObj := TStringClass.CreateString([AStr]);');
  1797.       Writeln('TObj.ToUpper;');
  1798.       Writeln('C := TObj.AnsiCompareText(AStr);');
  1799.       Writeln;
  1800.       Writeln('Result : ');
  1801.       Writeln;
  1802.       TObj := TStringClass.CreateString([AStr]);
  1803.       TObj.ToUpper;
  1804.       C := TObj.AnsiCompareText(AStr);
  1805.       Writeln(TObj.ZString,' : ',AStr,' : ',C);
  1806.       TObj.Free;
  1807.    END;
  1808.  
  1809.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1810.  
  1811.    PROCEDURE DoAnsiLowerCase;
  1812.    VAR
  1813.       TObj : TStringClass;
  1814.       C : INTEGER;
  1815.    BEGIN
  1816.       Writeln('TObj := TStringClass.Create;');
  1817.       Writeln('TObj.AnsiLowerCase;');
  1818.       Writeln;
  1819.       Writeln('Result : ');
  1820.       Writeln;
  1821.       TObj := TStringClass.Create;
  1822.       TObj.AnsiLowerCase(AStr);
  1823.       Writeln(TObj.ZString);
  1824.       TObj.Free;
  1825.    END;
  1826.  
  1827.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1828.  
  1829.    PROCEDURE DoAnsiUpperCase;
  1830.    VAR
  1831.       TObj : TStringClass;
  1832.       C : INTEGER;
  1833.    BEGIN
  1834.       Writeln('TObj := TStringClass.Create;');
  1835.       Writeln('TObj.AnsiUpperCase;');
  1836.       Writeln;
  1837.       Writeln('Result : ');
  1838.       Writeln;
  1839.       TObj := TStringClass.Create;
  1840.       TObj.AnsiUpperCase(AStr);
  1841.       Writeln(TObj.ZString);
  1842.       TObj.Free;
  1843.    END;
  1844.  
  1845.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1846.  
  1847.    PROCEDURE DoAppendStr;
  1848.    VAR
  1849.       TObj : TStringClass;
  1850.       C : INTEGER;
  1851.    BEGIN
  1852.       Writeln('TObj := TStringClass.CreateString([APChar]);');
  1853.       Writeln('TObj.AppendStr(AStr);');
  1854.       Writeln;
  1855.       Writeln('Result : ');
  1856.       Writeln;
  1857.       TObj := TStringClass.CreateString([APChar]);
  1858.       TObj.AppendStr(AStr);
  1859.       Writeln(TObj.ZString);
  1860.       TObj.Free;
  1861.    END;
  1862.  
  1863.    { +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ }
  1864.  
  1865. BEGIN
  1866.    ANullStrObj := TStringClass.Create;
  1867.    AStrObj := TStringClass.CreateString(['TStringClass string']);
  1868.    OutConsole.ClrScr;
  1869.    CASE fid OF
  1870.       id_Create :
  1871.          DoCreate;
  1872.       id_CreateSize :
  1873.          DoCreateSize;
  1874.       id_CreateString :
  1875.          DoCreateString;
  1876.       id_CreateStringNL :
  1877.          DoCreateStringNL;
  1878.       id_CreateBoolean :
  1879.          DoCreateBoolean;
  1880.       id_Destroy :
  1881.          DoDestroy;
  1882.       id_Copy :
  1883.          DoCopy;
  1884.       id_CopyFrom :
  1885.          DoCopyFrom;
  1886.       id_Clear :
  1887.          DoClear;
  1888.       id_Empty :
  1889.          DoEmpty;
  1890.       id_Assign :
  1891.          DoAssign;
  1892.       id_AssignFrom :
  1893.          DoAssignFrom;
  1894.       id_AssignLen :
  1895.          DoAssignLen;
  1896.       id_AssignMid :
  1897.          DoAssignMid;
  1898.       id_AssignNL :
  1899.          DoAssignNL;
  1900.       id_AssignPad :
  1901.          DoAssignPad;
  1902.       id_AssignRight :
  1903.          DoAssignRight;
  1904.       id_AssignTrim :
  1905.          DoAssignTrim;
  1906.       id_Append :
  1907.          DoAppend;
  1908.       id_AppendBoolean :
  1909.          DoAppendBoolean;
  1910.       id_AppendByte :
  1911.          DoAppendByte;
  1912.       id_AppendCh :
  1913.          DoAppendCh;
  1914.       id_AppendDIC :
  1915.          DoAppendDIC;
  1916.       id_AppendDouble :
  1917.          DoAppendDouble;
  1918.       id_AppendDoubleTrim :
  1919.          DoAppendDoubleTrim;
  1920.       id_AppendExt :
  1921.          DoAppendExt;
  1922.       id_AppendExtTrim :
  1923.          DoAppendExtTrim;
  1924.       id_AppendLen :
  1925.          DoAppendLen;
  1926.       id_AppendLong :
  1927.          DoAppendLong;
  1928.       id_AppendMid :
  1929.          DoAppendMid;
  1930.       id_AppendNL :
  1931.          DoAppendNL;
  1932.       id_AppendPad :
  1933.          DoAppendPad;
  1934.       id_AppendPtr :
  1935.          DoAppendPtr;
  1936.       id_AppendReal :
  1937.          DoAppendReal;
  1938.       id_AppendRight :
  1939.          DoAppendRight;
  1940.       id_AppendSIC :
  1941.          DoAppendSIC;
  1942.       id_AppendTrim :
  1943.          DoAppendTrim;
  1944.       id_AppendWithTab :
  1945.          DoAppendWithTab;
  1946.       id_NLAppend :
  1947.          DoNLAppend;
  1948.       id_Prepend :
  1949.          DoPrepend;
  1950.       id_FirstNonSpaceCh :
  1951.           DoFirstNonSpaceCh;
  1952.       id_HasCh :
  1953.          DoHasCh;
  1954.       id_isCh :
  1955.          DoIsCh;
  1956.           (*
  1957.       id_IsFirstCh = 44;
  1958.       id_IsLastCh = 45;
  1959.       id_LastNonSpaceCh = 46;
  1960.       id_RemoveLastCh = 47;
  1961.       id_SetCh = 48;
  1962.       id_FromBoolean = 49;
  1963.       id_FromByte = 50;
  1964.       id_FromChar = 51;
  1965.       id_FromDouble = 52;
  1966.       id_FromDoubleTrim = 53;
  1967.       id_FromExt = 54;
  1968.       id_FromExtTrim  = 55;
  1969.       id_FromLong = 56;
  1970.       id_FromPtr = 57;
  1971.       id_FromReal = 58;
  1972.       id_FromRealTrim = 59;
  1973.       *)
  1974.       id_FromRGB :
  1975.          DoFromRGB;
  1976.          (*
  1977.       id_HexFromByte = 61;
  1978.       id_HexFromLong = 62;
  1979.       id_HexFromPtr = 63;
  1980.       id_HexFromWord = 64;
  1981.       id_ToBoolean = 65;
  1982.       id_ToByte = 66;
  1983.       id_ToChar = 67;
  1984.       id_ToDouble = 68;
  1985.       id_ToExt = 69;
  1986.       id_ToInteger = 70;
  1987.       id_ToLong = 71;
  1988.       id_ToReal = 72;
  1989.       id_ToRGB = 73;
  1990.       id_ToWord = 74;
  1991.       *)
  1992.       id_AppendStr :
  1993.          DoAppendStr;
  1994.          (*
  1995.       id_UpperCase = 76;
  1996.       id_LowerCase = 77;
  1997.       id_CompareStr = 78;
  1998.       id_CompareText = 79;
  1999.       *)
  2000.       id_AnsiUpperCase :
  2001.          DoAnsiUpperCase;
  2002.       id_AnsiLowerCase :
  2003.          DoAnsiLowerCase;
  2004.       id_AnsiCompareStr :
  2005.          DoAnsiCompareStr;
  2006.       id_AnsiCompareText :
  2007.          DoAnsiCompareText;
  2008.       (*
  2009.       id_IsValidIdent = 84;
  2010.       id_IntToStr = 85;
  2011.       id_IntToHex = 86;
  2012.       id_StrToInt = 87;
  2013.       id_StrToIntDef = 88;
  2014.       id_LoadStr = 89;
  2015.       id_FmtLoadStr = 90;
  2016.       id_Format = 91;
  2017.       id_FloatToStr = 92;
  2018.       id_FloatToStrF = 93;
  2019.       id_FormatFloat = 94;
  2020.       id_StrToFloat = 95;
  2021.       id_StrCat = 96;
  2022.       id_StrComp = 97;
  2023.       id_StrCopy = 98;
  2024.       id_StrECopy = 99;
  2025.       id_StrEnd = 100;
  2026.       id_StrIComp = 101;
  2027.       id_StrLCat = 102;
  2028.       id_StrLIComp = 103;
  2029.       id_StrLComp = 104;
  2030.       id_StrLCopy = 105;
  2031.       id_StrLen = 106;
  2032.       id_StrLower = 107;
  2033.       id_StrMove = 108;
  2034.       id_StrPas = 109;
  2035.       id_StrPCopy = 110;
  2036.       id_StrPos = 111;
  2037.       id_StrRScan = 112;
  2038.       id_StrScan = 113;
  2039.       id_StrUpper = 114;
  2040.       id_Compare = 115;
  2041.       id_CompareI = 116;
  2042.       id_CompareL = 117;
  2043.       id_CompareLI = 118;
  2044.       id_CompareLong = 119;
  2045.       id_CompareDouble = 120;
  2046.       id_CompareExt = 121;
  2047.       id_IsSame = 122;
  2048.       id_IsSameI = 122;
  2049.       id_isSameL = 123;
  2050.       id_IsSameLI = 124;
  2051.       id_Includes = 125;
  2052.       id_Within = 126;
  2053.       *)
  2054.       id_Delete :
  2055.          DoDelete;
  2056.       id_DeleteFrom :
  2057.          DoDeleteFrom;
  2058.       (*
  2059.       id_Insert = 128;
  2060.       id_InsertL = 129;
  2061.       id_PadCentre = 130;
  2062.       id_PadEnd = 131;
  2063.       id_PadFront = 132;
  2064.       id_RemoveDIC = 133;
  2065.       id_RemoveSIC = 134;
  2066.       id_Trim = 135;
  2067.       id_TrimEnd = 136;
  2068.       id_TrimFront = 137;
  2069.       id_TrimZero = 138;
  2070.       *)
  2071.       id_FindCmdLine :
  2072.          DoFindCmdLine;
  2073.       (*
  2074.       id_FindCmdLineAndParse = 140;
  2075.       id_FindCmdLineParam = 141;
  2076.       id_AppendStringRes = 142;
  2077.       id_LoadStringRes = 143;
  2078.       id_ReadIniKeyword = 144;
  2079.       id_WriteIniKeyword = 145;
  2080.       id_FindIniSectionKeywords = 146;
  2081.       *)
  2082.       id_AddBackSlash :
  2083.          DoAddBackSlash;
  2084.          (*
  2085.       id_BuildPathName = 148;
  2086.       id_DefaultExtension = 149;
  2087.       id_ExpandFileName = 150;
  2088.       *)
  2089.       id_addFilterDesc :
  2090.          DoAddFilterDesc;
  2091.       id_FindRelPath :
  2092.          DoFindRelPath;
  2093.       (*
  2094.       id_ForceExtension = 151;
  2095.       id_HasBackSlash = 152;
  2096.       id_HasDrive = 153;
  2097.       id_HasExtension = 154;
  2098.       id_HasFileName = 155;
  2099.       id_HasDirectory = 156;
  2100.       *)
  2101.       id_FindCurrentDir :
  2102.          DoFindCurrentDir;
  2103.       id_DirectoryExists :
  2104.          DoDirectoryExists;
  2105.       (*
  2106.       id_DriveExists = 158;
  2107.       *)
  2108.       id_FileExists :
  2109.          DoFileExists;
  2110.       id_FileSplit :
  2111.          DoFileSplit;
  2112.       id_JustExtension :
  2113.          DoJustExtension;
  2114.       id_JustFileName :
  2115.          DoJustFileName;
  2116.       id_JustName :
  2117.          DoJustName;
  2118.       id_JustDirectory :
  2119.          DoJustDirectory;
  2120.          (*
  2121.       id_SetCurDir = 163;
  2122.       id_ChCount = 164;
  2123.       id_FindBetween2Ch = 165;
  2124.       id_FindFirst = 166;
  2125.       id_FindFirstCh = 167;
  2126.       id_FindLast = 168;
  2127.       id_FindLastCh = 169;
  2128.       id_FindNext = 170;
  2129.       id_FindNextCh = 171;
  2130.       id_FindPrev = 172;
  2131.       id_FindPrevCh = 173;
  2132.       id_SubStrCount = 174;
  2133.       id_FirstCharToUpper = 175;
  2134.       id_IsAlphaNumeric = 176;
  2135.       id_ToLower = 177;
  2136.       id_ToUpper = 178;
  2137.       *)
  2138.       id_ReplaceAll :
  2139.          DoReplaceAll;
  2140.       (*
  2141.       id_ReplaceFirst = 180;
  2142.       id_ReplaceLast = 181;
  2143.       id_ReplaceChAll = 182;
  2144.       id_ReplaceChFirst = 183;
  2145.       id_ReplaceChLast = 184;
  2146.       id_FirstParseDelim = 185;
  2147.       id_NextParseDelim = 186;
  2148.       id_ParseDelimCount = 187;
  2149.       *)
  2150.       id_ParseDelimToList :
  2151.          DoParseDelimToList;
  2152.       id_ParseMultiDelimToList :
  2153.          DoParseMultiDelimToList;
  2154.       (*
  2155.       id_ParsePosToList = 189;
  2156.       *)
  2157.       id_grep :
  2158.          DoGrep;
  2159.    END;
  2160.    { scroll to top }
  2161.    OutConsole.ScrollTo(0,0);
  2162. END;
  2163.  
  2164. { :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: }
  2165.  
  2166.  
  2167. end.
  2168.