delphi基础

1.集合的用法
(1)
IN 判断是否存在

type
TCharset = set of char;
var
t: TCharset;

begin
t:= ['a','b','s'];
if 's' in t then
ShowMessage('in');
end;

判断是否缺乏

if not ('m' in t) then
// do something
(2)增加删除
+ ,-
Include(t,'m');
ExClude(t,'a');
(3)交集
if ['a','b']*t=['a','b'];
2.什么时候用new
 new()给指向已知大小的结构的指针分配内参,记住用Dispose()释放new()申请的任何内存
  用GetMem()或AllowMem()给未知大小的结构分配内存。并用FreeMem()清除
   AllowMem()比GetMem()安全,因为把申请到的内存初始为零
3. 创建命名类型完成a对b的赋值
type
PtrInteger = ^Integer;
var
a,b:PtrInteger;
4.类型别名
type
MInt :Integer;
强类型(strongly typed):
type
 MInt  = type integer; (MInt 与Integer不兼容)
5.类型转换

只有两个变量的数据占用的内存大小相同时才能进行

浮点转整数:Trimc()或者Round()
整数到浮点: 使用赋值
6.字符串资源:
resourcestring:
resstring ='resource'
7.参数传递
--------------------------------------
1.值参数
procedure fun(s:string);
2.引用参数
procedure fun(var s:string);
3.常量参数
procedure fun(const s:string);
4.开放数组
function fun(a:array of integer):integer;
使用high(),low(),sizeof()获得数组信息
----------------------------------------
8.

 

 

转载于:https://www.cnblogs.com/alon/archive/2010/01/26/1657016.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值