Saturday, February 24, 2007

10 of Most Delphi Used Function

Here is 10 functions mostly used

procedure TForm1.Button1Click(Sender: TObject);
var
S: String;
begin
{ 1 }
S := Copy('Delphi Rulezz', 5, 6); { Reads the text }
ShowMessage(S);
{ 2 }
S := Concat('1 ',' Two, ','3'); { Connects the text }
ShowMessage(S);
{ 3 }
ShowMessage('Length: '+IntToStr(Length('Good'))); { Shows the length of the
string in numbers [integer] }
{ 4 }
S := 'The Example'; {Deletes the text }
Delete(S, 8, 7);
ShowMessage(S);
{ 5 }
S := 'Ralph is a dog';
Insert('good ', S, 12); { Inserts the text }
ShowMessage(S);
{ 6 }
S := 'Delphi';
ShowMessage(UpperCase(S)); { Converts the text to upper case }
{ 7 }
S := 'Delphi';
ShowMessage(LowerCase(S)); { Converts the text to lower case }
{ 8 }
S := 'Delphi';
ShowMessage('''P'' in ''Delphi'' is:'+IntToStr(Pos('p',S))+'th'); { Gets
the position of the string in the string }
{ 9 }
S := 'a1, a2, a3, a4, a5.';
ShowMessage('a change to b: ' + StringReplace(S, 'a', 'b', [rfReplaceAll]));
{ Changes the text from one to another }
{ 10 }
S := 'This text:goes lower.';
S := WrapText(S, #13#10, [':'], 12);
ShowMessage(S); { Moves the text lower }
end;

No comments: