以下三个是二进制操作:
xor 与或 3 xor 5 = 6
shl 左移 左移一位相当于乘2 10 shl 2 =40
shr 右移 右移一位相当于除2 10 shl 2 =4
ord 是取字符的 ASCII码: ord('A') =65
pos 在字符串中查找一个子串,返回的是位置:
pos('AB','CDABEF') =3
Returns the index value of the first character in a specified substring that occurs in a given string.
Unit
System
Category
string handling routines
function Pos(Substr: string
S: string): Integer;
Description
Pos searches for a substring, Substr, in a string, S. Substr and S are string-type expressions.
Pos searches for Substr within S and returns an integer value that is the index of the first character of Substr within S. Pos is case-sensitive. If Substr is not found, Pos returns zero.
var S: string;
begin
S := ' 123.5';
{ Convert spaces to zeroes }
while Pos(' ', S) > 0 do
S[Pos(' ', S)] := '0';
end;
# 后跟一个整数也表示一个字符,一般表示不可见字符 如 #13#10 回车换行。
#65 和 char(65) 一样,写起来简单一点,可以直接嵌入在串中。
@ 取变量的地址,如:
var
p
char;
s:string;
begin
s:='1234';
p:=@s;
end;