Re: CORRECTED TEST AND ANSWERS.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



> Create a different one-liner equivalent to this statement
>
> Value = IIf(Len(TextString) > 0, "'" & TextString & "'", "NULL")
>
> ---ANSWER
> Value = Format$(Len(TextString), Trim$(Left$(Join(Split(StrConv( _
> " " & TextString, vbUnicode), Chr$(0)), "\"), _
> 2 * Len(TextString) + 1)) & ";;\N\U\L\L")

I thought we decided (or at least I think I said) that it would be
unfair to ask this question. Also, this is not the only possible
one-liner solution. When I originally posted this, it was meant as a
joke (I'm pretty sure I included a <g> symbol in the posting). Later,
I suggested showing the If-Then-Else version of the IIF function you
posted, then showing that mess of a one-liner I posted and asking that
the person explain how and why they are equivalent (although Bob has
pointed out that I left out the single quotes). And I suggested that
it be either an extra-credit question OR a question to throw at a
know-it-all type applicant. But, to repeat, I don't think the question
is a fair one to ask straight-away.

Rick


.



Relevant Pages

  • Re: CORRECTED TEST AND ANSWERS.
    ... >> Create a different one-liner equivalent to this statement ... >I suggested showing the If-Then-Else version of the IIF function you ... >pointed out that I left out the single quotes). ...
    (microsoft.public.vb.general.discussion)
  • Re: CORRECTED TEST AND ANSWERS.
    ... >> Create a different one-liner equivalent to this statement ... > I suggested showing the If-Then-Else version of the IIF function you ... > pointed out that I left out the single quotes). ...
    (microsoft.public.vb.general.discussion)
  • Re: CORRECTED TEST AND ANSWERS.
    ... >>> unfair to ask this question. ... >>> (although Bob has pointed out that I left out the single quotes). ... >> have to say about that one-liner could be very interesting! ... applicant's reasoning as they worked through a question so my impression was ...
    (microsoft.public.vb.general.discussion)
  • Re: CORRECTED TEST AND ANSWERS.
    ... then showing that mess of a one-liner I posted and asking ... >> pointed out that I left out the single quotes). ... impression that the questionnaire was in printed form, ... If presented as in my second suggestion (show the ...
    (microsoft.public.vb.general.discussion)