I could've sworn I tried that, and it didn't work...
I did find something that worked, even though it's a bit of a hack...
if (String(returnedItem) == "[object Object]") {
//I know it's a VO and not a String
}
So that works... I'll give your suggestion a try and see if that works --
although I think I tried it already.
Thanks for the suggestion,
L.
--- In [email protected], "robert.vancuren...@..."
<robert.vancuren...@...> wrote:
>
> Use the is operator
>
> If (returnedItem is String)
>
>
>
>
> -- Sent from my Palm Pre
> On Mar 27, 2010 4:23 PM, Laurence lmacne...@... wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
> I have a function (not written by me) that's returning either a String or a
> ValueObject, depending on whether or not it finds a match in an
> ArrayCollection of ValueObjects. If it finds a match, it returns the
> ValueObject that matches the search string. If it doesn't find a match, it
> returns the search-string itself.
>
>
>
> So, here's my question -- how do I know if what's being returned is a String
> or a ValueObject?
>
>
>
> I need something like the following:
>
> if returnedItem isString {
>
> //do stuff needed for when match isn't found
>
> } else {
>
> //do stuff needed for when match is found
>
> }
>
>
>
> But I can't figure out how to word that 'if' statement -- how do you ask it
> if it is a String or a ValueObject, without knowing in advance what it's
> going to be?
>
>
>
> Thanks,
>
> Laurence MacNeill
>
> Mableton, Georgia, USA
>