社区
脚本语言
帖子详情
如何判断字符串是否为空? --perl
cuiht
2004-03-31 06:58:10
如何判断字符串是否为空?
...全文
8033
3
打赏
收藏
如何判断字符串是否为空? --perl
如何判断字符串是否为空?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
okdns
2004-04-01
打赏
举报
回复
if ($xxx eq "") {}
w3guy
2004-03-31
打赏
举报
回复
判断字符串是否为空一般用以下可以了:
if(!$str) {
print "this is an empty/undefined string\n"
}
如果你还想区别空串"" 和未赋有效值的串可以用
if(!$str) {
if(defined $str) {
print "this is an empty string\n"
}
else {
print "this is an undefined string\n"
}
}
qbqzhanying
2004-03-31
打赏
举报
回复
#!/usr/bin/perl -w
use strict;
my $abc='aaaaa';
print "is defined:\n";
is_undef($abc);
print "is undefined:\n";
undef $abc;
is_undef($abc);
print "is '':\n";
$abc='';
is_undef($abc);
sub is_undef{
my $abc=shift;
print "1:";
if($abc){
print "is defined\n";
}else{
print "is undefined\n";
}
print "2:";
if(defined $abc){
print "is defined\n";
}else{
print "is undefined\n";
}
print "3:";
if($abc eq ''){
print "is undefined\n";
}else{
print "is defined\n";
}
print "\n";
}
------------------------------------------------
战鹰的Perl空间:http://www.blogunion.com/members/zhanying/
Redis实战视频课程
和Memcached类似,它支持存储的value类型相对更多,包括string(
字符串
)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更...
perl
判断
空
字符串
判断
字符串
是否为空
一般用以下可以了: if(!$str) { print "this is an empty/undefined string\n " } 如果你还想区别空串 " " 和未赋有效值的串可以用 if(!$
如何
判断
字符串
是否为空
串?[C#]
如何
判断
字符串
是否为空
串?[C#] Written by Allen Lee 0. 缘起:本文写作缘起于阮的讨论——《FxCop告诉我,检查一个
字符串
是否为空
要用string.Length。》。其实用过FxCop的人都知道它会建议你使用String.Length...
Perl
判断
字符串
为空
[oracle@jhoa ip_sec]$ cat 2.pl $_='{"code":0,"data":{"country":"台湾","country_id":"TW","area":"","area _id":"","region":"台湾省","region_id":"TW_01",...[oracle@jhoa ip_sec]$
perl
2.pl $city is
lua
判断
字符不为空或空格_lua简单
字符串
处理
本文内容向导介绍
字符串
连接与构造
字符串
格式大小写转换分割
字符串
位置查找子符串介绍我认为,当涉及到
字符串
处理,
Perl
的凯迪拉克工业。但是Lua在
字符串
前面也不错.
字符串
连接与构造级联Lua中使用两个操作符一样...
脚本语言
37,720
社区成员
34,239
社区内容
发帖
与我相关
我的任务
脚本语言
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
复制链接
扫一扫
分享
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
试试用AI创作助手写篇文章吧
+ 用AI写文章