Programming is constantly associated with working with some data, in particular with strings. The string operator is specified identically in most languages, including Pascal: string. But Pascal has its own characteristics and properties that you need to know before starting work.
What is the string in Pascal?
Before you understand the syntax of a string data type in Pascal, you should understand what can be a string. In fact, in Pascal, a string is an array of characters, each of which can be any element from an ASCII table. That is, any letter, number, punctuation mark or space can be used as a string.
255 , . , , string. Pascal , .
String. Pascal - 255. , , - string , , . "str", 10 :
var str: string[10].
Pascal string - .
, , . .
( ) . : "+". , , .
, , . , , , , , : " ".
, Pascal, - string compare . :
- (=);
- / (> <);
- (< >);
- (>= <=).
true false.
, . , , , , , , , .
, Pascal , . , , . 4 :
Copy (S, poz, n) - S - , poz n - .
Concat(s1,s2...).
Length(str).
Pos(subS, S).
, Pascal, . , - .
, Delete , , . :
Delete (S, poz, n).
Insert. - , , :
Insert(subS, S, poz).
, . , , string integer. Pascal , , , , . :
- string integer Pascal StrToInt. , .
- , StrToFloat. , , .
- - - FloatToStr IntToStr .
- , , - Str Val. - . , - , , . , , , , , , 0.