Procedure Delete(var S: string; Index, Count:Integer);
|
S satrdagi Index - belgidan Count ta belgini o`chirib tashlaydi
|
Procedure Insert(Source: string; var S: string; Index: Integer);
|
S satriga Index - belgidan boshlab Sourse satrini joylashtiradi
|
Yuqoridagi amallarga misol qilib quyidagilarni keltirish mumkin:
1.8-rasm
unit Satr_p;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;
type
TForm1 class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Label3: TLabel;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Label3.Caption : 'Birinchi yozuvdagi belgilar soniq ' IntToStr(Length(Label1.Caption));
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Label3.Caption : Concat(Label1.Caption, Label2.Caption);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Label3.Caption : Copy(Label1.Caption, 13, 7);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Label3.Caption : 'Birinchi yozuvdagi "xan" suzi ' IntToStr(Pos('xan', Label1.Caption)) ' - belgidan boshlangan';
end;
procedure TForm1.Button5Click(Sender: TObject);
Var
S: String;
begin
S : Label2.Caption;
Delete(S, 12, 11);
Label3.Caption : S;
end;
procedure TForm1.Button6Click(Sender: TObject);
Var
S: String;
begin
S : Label1.Caption;
Insert('va ', S, 13);
Label3.Caption : S;
end;
end.
§-1.2.5. Massivlar. Massivlar ustida amallar
Dasturlashda eng ko`p qo`llaniladigan dastur ob`ektlarining biri bo`lgan massivlar bilan tanishib chiqamiz.
Massiv - bu bir xil tipli, chekli qiymatlarning tartiblangan to`plamidir. Massivlarga misol sifatida matematika kursidan ma`lum bo`lgan vektorlar, matritsalar va tenzorlarni ko`rsatish mumkin.
Dasturda ishlatiluvchi barcha massivlarga o`ziga xos ism berish kerak. Massivning har bir hadiga murojaat esa uning nomi va o`rta qavs ichiga olib yozilgan tartib hadi orqali amalga oshiriladi.
Massivning zarur hadiga murojaat quyidagicha amalga oshiriladi:
Do'stlaringiz bilan baham: |