Re: isNotEqualToString

  • On 13 Feb 2009, at 10:00, Chunk 1978 wrote:

    > -=-=-=-
    > if ((![currentDesktopBackgroundImage isEqualToString:firstPath]) ||
    > (![currentDesktopBackgroundImage isEqualToString:secondPath]))
    > {
    > //Go South
    > }

    lets assume that currentDesktopBackgroundImage IS firstPath (and that
    secondPath ≠ firstPath)

    The first portion of your test gives false so it tries the second
    portion.
    This gives true, since currentDesktopBackgroundImage ≠ secondPath

    so you go south. Your version will always Go South UNLESS
    currentDesktopBackgroundImage == firstPath == secondPath

    I think you want this;

    if (!([currentDesktopBackgroundImage isEqualToString:firstPath] ||
    [currentDesktopBackgroundImage isEqualToString:secondPath]))
    {
    //Go South
    }

    Matt
previous month february 2009 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28  
Go to today