When dealing with use input I usually use the following... which will 
evaluate to true only if strValue has more than one non-space 
character.  i.e. a string with only spaces will be treated as no input.

if (strValue != null && StringUtil.trim(strValue).length > 0)
{
   //your code here
}

if you want to process input that has only spaces just leave off the 
call to StringUtil.trim.

hth
Scott

Scott Melby
Founder, Fast Lane Software LLC
http://www.fastlanesw.com
http://blog.fastlanesw.com



reflexactions wrote:
> I have an if statement that is supposed to catch nulls and empty 
> strings:
> if(strValue).....
>
> The  problem I am having is in one situation with strValue having a 
> value of "" the if statement executes..
>
> actually in the debugger
> !strValue is true and strValue is true
>
> I am more interested in why this isnt working than how to fix it if 
> anyone has an idea.
>
> tks
>
>
>
>
>
>
>   

Reply via email to