CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

I had to take str=str.trim() out


[Replies] [Reply] [View by Thread] [Help]
[Back To SNEAK Development Forum]

Posted by Cpt SAJChurchey On 2005-02-26 19:16:27
In Reply to RE: Java - Backwards - Second Draft Posted by Lt dopel On 2005-02-26 16:51:44

Cpt
Cpt SAJChurchey


because if the string is null, it will through a NullPointerException. str must first be tested for null before any other functions can be performed on it. I had to use trim twice because I cannot do an assignment and check in the if statement. I could set up two separate if statements though:
if(str == null)
  return "";
str = str.trim();
if(str.length() == 0)
  return "";
Do you think that would be better?

Cpt SAJChurchey
C/O of
Editorial
OSI Staff edit0r
OSI Feedback Representative




Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.02304 seconds


About Us | Privacy Policy | Mission Statement | Help