If you are looking for concise...
if ("") then "yep" else "nope" ==> nope
if (()) then "yep" else "nope" ==> nope
if ("foo") then "yep" else "nope" ==> yep
On Apr 13, 2012, at 12:09 PM, David Lee wrote:
> XQuery constantly surprises me !
> Today I was looking for a more concise way of testing if a string is empty or
> blank.
> The best I came up with is
>
> empty($s) or $s eq ''
> or
> string-length($s) eq 0
>
> But along the way discovered this
> if( () eq () ) then 1 else 2
> if( () = () ) then 1 else 2
>
> Returns 2 !!!
>
> Of course in hindsight and fine-print its correct, but entirely non-obvious
> to my eye ...
> Well back to work !
>
>
>
> ----------------------------------------
> David A. Lee
> [email protected]
> http://www.xmlsh.org
>
> _______________________________________________
> [email protected]
> http://x-query.com/mailman/listinfo/talk
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk