Topic: [求助]怎么判断字符串为空???

  Print this page

1.[求助]怎么判断字符串为空??? Copy to clipboard
Posted by: linzhoulxyz
Posted on: 2005-04-15 12:20

在Applet中怎么判断TextField中的内容是否为空???
谢谢`~~

2.Re:[求助]怎么判断字符串为空??? [Re: linzhoulxyz] Copy to clipboard
Posted by: shyboy
Posted on: 2005-04-15 13:27

gettext==""

3.Re:[求助]怎么判断字符串为空??? [Re: linzhoulxyz] Copy to clipboard
Posted by: 铁针
Posted on: 2005-04-15 15:37

if (string.length()<1)
//string is empty

4.Re:[求助]怎么判断字符串为空??? [Re: linzhoulxyz] Copy to clipboard
Posted by: linzhoulxyz
Posted on: 2005-04-15 16:35

哦,知道了,谢谢各位

5.Re:[求助]怎么判断字符串为空??? [Re: linzhoulxyz] Copy to clipboard
Posted by: leon0122
Posted on: 2005-05-19 16:54

都不是好方法
可以参考:
txtfield.getTest().equals("")

6.Re:[求助]怎么判断字符串为空??? [Re: leon0122] Copy to clipboard
Posted by: why
Posted on: 2005-05-20 04:14

leon0122 wrote:
都不是好方法
可以参考:
txtfield.getTest().equals("")

Could you guys be a little bit more careful?
getText()

7.Re:[求助]怎么判断字符串为空??? [Re: why] Copy to clipboard
Posted by: YuLimin
Posted on: 2005-05-21 14:40

"".equals(txtfield.getText().trim())

8.Re:[求助]怎么判断字符串为空??? [Re: why] Copy to clipboard
Posted by: 8166680
Posted on: 2005-05-23 01:36

why wrote:
Could you guys be a little bit more careful?
getText()


呵我也正想指出来

9.Re:[求助]怎么判断字符串为空??? [Re: 8166680] Copy to clipboard
Posted by: szaba
Posted on: 2005-07-10 11:20

8166680 wrote:
呵我也正想指出来


呵呵 楼上的和WHY老大都很认真啊 真吾等菜鸟之幸也!

10.Re:[求助]怎么判断字符串为空??? [Re: YuLimin] Copy to clipboard
Posted by: RingofAngel
Posted on: 2005-07-12 09:06

YuLimin wrote:
"".equals(txtfield.getText().trim())


Why you use .trim()??
If I define “String textField1=" ";"
Would that be a empty character string?
Please tell me?I`m a novice

11.Re:[求助]怎么判断字符串为空??? [Re: linzhoulxyz] Copy to clipboard
Posted by: RingofAngel
Posted on: 2005-07-12 09:08

Sorry textField1 should be some blanks.
Not only one!!!

12.Re:[求助]怎么判断字符串为空??? [Re: RingofAngel] Copy to clipboard
Posted by: 左手习惯
Posted on: 2005-07-12 12:21

RingofAngel wrote:
Why you use .trim()??
If I define “String textField1=" ";"
Would that be a empty character string?
Please tell me?I`m a novice

trim()忽略String开头的空格和连续的空格。
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#trim()

13.Re:[求助]怎么判断字符串为空??? [Re: RingofAngel] Copy to clipboard
Posted by: 左手习惯
Posted on: 2005-07-12 12:22

RingofAngel wrote:
Sorry textField1 should be some blanks.
Not only one!!!

这应该就是一个应用Wink


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923