, , :
- ;
- STRING () ARRAY[0..N] OF CHAR, , , - 0 255. N, , N=255.
:
1. (+) , :
SumStr:= 'Borland' + 'Pascal' + '7.0'
2. (=, <>, >, <, >=, <=) , , .
,
' mS-DOS' < 'MS-Dos'
'123' < '2 '
'' < ' '
, , , , .
:
¾ length(S:string):byte S.
¾ concat(S1,S2,..SN:string):string S1...SN.
¾ copy(S:string; Start, Len:integer):string S Len, Start.
¾ delete(var S:string; Start,Len:integer) S Len, Start.
¾ insert(var S:string; Subs:string; Start:integer) S Subs, Start.
¾ pos(Subs,S:string):byte Subs S S, . , .
¾ str(X; var S:string) X S.
¾ val(S:string; var X; var E:integer) S X, E .
1. . 'st'.
:
st | ||
st ghhgst stjkj | ||
sthghjghghghst |
:
Program Kolichestvo_ST;
var
str: string;
counter, I: integer;
begin
repeat { }
writeln (' ');
readln(Str)
until length(Str)<>0;
counter:=0;
for I:=1 to length(str)-1 do { if str[i]+str[i+1]=st}
if (str[i]=s) and (str[i+1]=t) then
inc(counter);
writeln(' counter = ', counter);
readln;
end.
2. . (a, e, i, o, u, y) .
:
st | ||
123 erty asd | 3 4 | |
sdfdg3 43 3rtg 23 | 0 8 |
:
|
|
Program Glasnie_Soglasnie;
const
gl=[' I', 'o', 'u', 'a', 'e', 'y'];
Digit=[' ', '0', '1', '2', '3', '4', '5', ' 6', '7', '8', '9'];
var
st: string;
gl_count, dig_count, i: integer;
begin
writeln (' ');
readln(st);
for I:=1 to length(st) do
begin
if st[i] in gl then
inc(gl_count);
if st[i] in digit then
inc(dig_count);
end;
writeln('glasn= ',gl_count');
writeln(soglasn= ', length(st)- gl_count - dig_count);
readln;
end.
3. , .
:
Text | st1 | st2 | ||
I go to school. | school | shop | I go to shop.. |
:
Program Change_St1_to_St2;
var
text, st1, st2: string;
p, i: integer;
begin
Writeln(' ');
readln(text);
Writeln(' ');
readln(st1);
Writeln(' ');
readln(st2);
p:=Pos(st1,text);
while p > 0 do
begin
Delete(text,P,length(st1));
Insert(st2, text,P);
p:=Pos(st1,text);
end;
writeln(text);
readln;
end.
1. . .
2. . .
3. . .
4. . .
5. . , 'kk'.
6. . ' * '.
7. . 'krokodil'.
8. . .
9. . .
10. . , .
11. , , .
12. .
13. . .
14. p . :
) , p;
) , p.
15. . .
16. , , . .
17. , .
18. , , .
19. . , .
20. , .
21. , . . . , .
9.
: .
:
¾ , ;
¾ ,
|
|
¾ , , - .
:
1. , , .
2. .
3. : [3: 6], [4: 8], [7: 11, 12], [10: 8].
4. .
5. .
: 4 5 1 3.