Re: Redundency of IsNull(Trim(myvar)) ?

From: songie D (songie_at_d.com)
Date: 05/20/04


Date: Thu, 20 May 2004 21:09:32 +0100

If myvar is a string, then it won't ever be null.
As far as I know the only things that can be 'null'
in VB6 are possibly objects and variants.

"Andy" <Andrzej7@hotmail.com> wrote in message
news:fd7401c43ea5$6d80f3b0$a101280a@phx.gbl...
>
> I think
>
> Trim(myVariable) where myVariable is NULL
> will give you an error - Invalid use of Null or something
> because you can not Trim NULL.
>
> You can do:
> Trim(myVariable & "") where myVariable is NULL
>
> --- Andy
>
> >-----Original Message-----
> >Hi,
> >
> >I am wondering if the following two statements always
> yield the same
> >results:
> >
> >1) If IsNull(Trim(myVariable)) Then [...]
> >
> >2) If IsNull(myVariable) Then [...]
> >
> >Basically, if myVariable is Null, then won't Trim
> (myVariable) also be Null?
> >Are there any instances when I would want to leave the
> Trim() function in
> >the above statement?
> >
> >Also, are the answers to these questions dependent on
> which VBA platform is
> >used (i.e. VB6 vs. VBScript)?
> >
> >Thanks in advance!
> >
> >JC
> >
> >
> >.
> >



Relevant Pages

  • Re: Fortran
    ... it didn't implement a working TRIM() in F77. ... CHARACTER*80 STRING ... EXTERNAL MYTRIM ... STRING = 'alongword' ...
    (comp.lang.fortran)
  • Re: Fortran
    ... it didn't implement a working TRIM() in F77. ... CHARACTER*10 MYTRIM ... STRING = 'hello' ... STRING = 'alongword' ...
    (comp.lang.fortran)
  • Trim() function chain-link. Please Help me...
    ... income dependent on the number in the household. ... that is I used the Trim() function... ... wrong that is preventing my string of codes to not recognize the other ... then move result to Cell C53 ...
    (microsoft.public.excel.programming)
  • Re: Question mark before node?
    ... Also it may be a good idea to remove the map ... the returned xml document has the xml declaration in ... I originally was not using a map, and was trying to trim the values ... string of the length of the field to the Xml document. ...
    (microsoft.public.biztalk.general)
  • Re: FAQ Topic - How do I trim whitespace - trim/trimRight/trimLeft (2007-12-25)
    ... though the Subject refers to whitespace the answer refers only to ... the word used alone is thus not ideal for describing what trim ... Most string manipulations are best done by using Regular Expressions. ...
    (comp.lang.javascript)

Loading