简单的问题,怎么判断一个串是不是为nil?

Ton2000 2003-09-29 03:54:43
如题
...全文
66 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
mengxiang5160 2003-09-29
  • 打赏
  • 举报
回复
var
str:string;
begin
if str=nil then
begin
你的动作;
end
else
begin
你的动作;
end;
end;
Ton2000 2003-09-29
  • 打赏
  • 举报
回复
呵呵,我以前是用C++Builder,在C++中串是否为空就是是否等于NULL,但在Delphi中不能写str <> nil,所以我就不懂了,刚才我试了下,str <> ''就行了,还是谢谢大家,给分了,分少,请别见怪!

还是非常感谢netwizard(流星雨),你让我又学到了些东西!
netwizard 2003-09-29
  • 打赏
  • 举报
回复
String: Length(Str) = 0
Variant: VarIsNull() or VarIsEmpty
Object: not Assigned()
netwizard 2003-09-29
  • 打赏
  • 举报
回复
Stirng:Lenght(Str) = 0
Variant: VarIsNull or VarIsEmpty
Object: not Assigned()
sailer_shi 2003-09-29
  • 打赏
  • 举报
回复
var
s: string;
begin
if s is null then
begin
end;
if s = null then
begin
end;
if s = '' then
begin
end;
end;
我怎么觉得字符串好像没有Null的值呀
  • 打赏
  • 举报
回复
什么串?
字符串?

if strvar='' then showmessage('it is nil');

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧