.
. , , , ... , BackSpace, . "" Delphi Char:
var c: Char;begin c:= ''; ShowMessage(' ' + c); c:= #13; ShowMessage(' ' + c + '');..., ANSI UNICODE. , . , "" "" - ! "" "", , .
, . , , - . . , <Esc>, <Enter>, <Tab> . 0 255, , "" : "207 208 200 194 197 210".
. Char :
var c,b: Char;begin c:= 'a'; b:= c;, . , . , '' , '':
if b > c then ShowMessage('!')else ShowMessage('!');Chr() Ord(). Chr() , , ANSI:
function Chr (X: Byte): Char;Ord() , , , ANSI:
function Ord (C: Char): Byte;:
a:= Chr(200); i:= Ord(a);i:= Ord('f');a "", 200. , , 200, a, . , 102, "f".
. . 4 : AnsiString ANSI , WideString UNICODE .
|
|
String , AnsiString. WideString, . , String:
var s: String;begin s:= ' ' + #13 + ''; ShowMessage(s);, , . 13, . ShowMessage() , :
ShortString ANSI . 0 255 . . , String :
var s: String[100];, , . , , . , , 1 1- .
var stroka: String;begin stroka:= ''; stroka[5]:= ''; // 5- ShowMessage(stroka); //: ""PChar
, . , String. String , , . PChar , , . PChar ?! ! ANSI, , . PChar , , , , .
PChar , , WinAPI . WinAPI Windows, Delphi. Delphi . , , Delphi . , , . MessageBox().
Delphi ShowMessage()? !
Application.MessageBox(' 1', ' 2',[ + _]);:
1 - .
2 .
[ + _] , ShowMessage().
10.1. | |||
MB_OK | () | ||
MB_OKCANCEL | ( ) | ||
MB_RETRYCANCEL | ( ) | ||
MB_YESNO | ( ) | ||
MB_YESNOCANCEL | (, ) | ||
MB_ABORTRETRYIGNORE | (, ) | ||
10.2. | |||
MB_ICONWARNING | ( "!") | ||
MB_ICONINFORMATION | ( "i") | ||
MB_ICONQUESTION | ( "?") | ||
MB_ICONERROR | ( ) | ||
, , , :
|
|
10.3. | |
IDOK | |
IDCANCEL | |
IDABORT | |
IDRETRY | |
IDIGNORE | |
IDYES | |
IDNO |
:
Application.MessageBox(' !', '', MB_ABORTRETRYIGNORE+MB_ICONERROR):
. 10.1. MessageBox()
. . Label , . Caption Label . . , case. :
case Application.MessageBox(' !', '', MB_ABORTRETRYIGNORE+MB_ICONERROR) of IDABORT: Label1.Caption:= ''; IDRETRY: Label1.Caption:= ''; IDIGNORE: Label1.Caption:= ''; end; //casecase . , , . , , Caption Label , .
, , . , MB_ICONQUESTION.
=, <, >, <=, >= . , . , . :
10.4. | ||
1 | 2 | |
1 > 2 | ||
1 < 2 | ||
1 > 2 |
: , , , , . , .
Length()
, . ( ). :
Var s: String; i: Integer;begin s:= ; i:= Length(s); // 6 i:= Length(); // - 7Delete
- . :
Delete(, p, n);:
.
p , .
n .
:
s:= ' -';Delete(s, 7, 6);s " ".
Pos()
Substr S . S , 0:
Pos (Substr: string; S: string): Integer;:
var S: string; I: Integer;begin S:= ' '; I:= Pos('', S); // I = 3end;Copy()
Count , Index. S ; Index Count . Index , . Count , , , Index S.
Copy (S, Index, Count): string;:
var S: string;begin S:= ''; S:= Copy(S, 3, 4); // S = ''end;. .
|
|