Know a good article or link that we're missing? Submit it!

View \STRINGTE.PAS

Using Null Terminated String Handling

Submitted By: Unknown
Rating: (Not rated) (Rate It)


program StringTest; {Test Strings Unit}

{$X+}

Uses Objects,TStrings;

const
 UpperAlpha : array [0..26] of char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'#0;
 LowerAlpha : array [0..26] of char = 'abcdefghijklmnopqrstuvwxyz'#0;
 Numeric    : array [0..10]  of char = '0123456789'#0;

var
 Test1 : pChar;
 Test2 : pChar;
 Test3 : pChar;
 St1   : array [0..1024] of char;
 St2   : array [0..1024] of char;
 res1  : integer;
 res2  : integer;

begin
StrCopy(@St1[0],@UpperAlpha[0]);
StrCat(@St1[0],@LowerAlpha[0]);
StrCopy(@St2[0],@UpperAlpha[0]);
res1:=StrComp(@St1[0],@St2[0]);
res1:=StrCSpn(@UpperAlpha[0],@LowerAlpha[0]);
Test1:=StrECopy(@St2[0],@UpperAlpha[0]);
Test2:=StrEnd(@St2[0]);
Res1:=StrIComp(@St1[0],@St2[0]);
StrLCopy(@St2[0],@Numeric[0],5);
Res1:=StrLComp(@St2[0],@Numeric[0],5);
StrLCat(@St2[0],@Numeric[0],7);
Res1:=StrLen(@St2[0]);
StrlCopy(@St2[0],@LowerAlpha[0],20);
Res1:=StrLIComp(@st1[0],@St2[0],15);
StrLower(@St1[0]);
StrUpper(@St2[0]);
StrMove(@St1[0],@St2[0],15);
Test2:=StrNew(@LowerAlpha[0]);
WriteLn(StrPas(Test2));
StrPCopy(@St2[0],'Hello World');
StrCat(@St1[0],@numeric[0]);
Test1:=StrPos(@St1[0],@Numeric[0]);
StrCopy(@st1[0],@St2[0]);
StrPCopy(@St2[0],'l');
Test1:=StrRScan(@St1[0],'l');
StrDispose(test2);
Test2:=StrScan(@St1[0],'l');
StrPCopy(@St2[0],'HELLO World');
Res1:=StrSpn(@St2[0],@UpperAlpha[0]);
StrUpper(@St2[0]);
end.
 
corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.