ord()取得那个Value值所在的位置,例如, type TMode = (mdIdle, mdBusy, mdWait, mdNone); ^ ^ ^ ^ 0 1 2 3这时,我们可以得到 Ord (mdIdle) 等于0 Ord (mdBusy) 等于1 ……或者 var str: string; begin str := 'asdkjfalsnd'; end; ////////////////////// Ord(str[0]) = 0; Ord(str[1]) = 1; …………………… 这个你可以自己做个试验试试看:)Example for ORDuses Dialogs; type Colors = (RED,BLUE,GREEN);var S: string; begin S := 'BLUE has an ordinal value of ' + IntToStr(Ord(BLUE)) + #13#10; S := S + 'The ASCII code for "c" is ' + IntToStr(Ord('c')) + ' decimal'; MessageDlg(S, mtInformation, [mbOk], 0, mbOK); end; _________________________________________ shl、shr都是位操作符,就好像C/C++语言里面的 <<、>>一样。
ord是取s[i]的ascii码
shl 是左移几位,shr是右移
type
TMode = (mdIdle, mdBusy, mdWait, mdNone);
^ ^ ^ ^
0 1 2 3这时,我们可以得到
Ord (mdIdle) 等于0
Ord (mdBusy) 等于1
……或者
var
str: string;
begin
str := 'asdkjfalsnd';
end;
//////////////////////
Ord(str[0]) = 0;
Ord(str[1]) = 1;
……………………
这个你可以自己做个试验试试看:)Example for ORDuses Dialogs;
type Colors = (RED,BLUE,GREEN);var S: string;
begin
S := 'BLUE has an ordinal value of ' + IntToStr(Ord(BLUE)) + #13#10;
S := S + 'The ASCII code for "c" is ' + IntToStr(Ord('c')) + ' decimal';
MessageDlg(S, mtInformation, [mbOk], 0, mbOK);
end;
_________________________________________
shl、shr都是位操作符,就好像C/C++语言里面的
<<、>>一样。