title: How to use "If" statements when comparing two strings in Objective C (Xcode)?
body: <p>I am trying to display a different website on each day of the week. I created a NSString that contains just the current day of the week by using NSDateFormatter. Then, I created additional strings for each day of the week. I am comparing the two in an "IF" Statement...so if the strings (days) are equal, it will perform the function in the if statement. if not, it checks the next statement. Right now it will work for the first statement on Monday, but when I change the date on my iPhone to simulate other days of the week it won't work. My code is below!</p>
  
  <pre><code>NSDateFormatter *dayofweekformatter = [[NSDateFormatter alloc] init];
  [dayofweekformatter setDateFormat:@"cccc"];
  
  NSString *DayOfWeek = [dayofweekformatter stringFromDate:[NSDate date]];
  
  
  NSString *Monday = @"Monday";
  NSString *Tuesday = @"Tuesday";
  NSString *Wednesday = @"Wednesday";
  NSString *Thursday = @"Thursday";
  NSString *Friday = @"Friday";
  NSString *Saturday = @"Saturday";
  NSString *Sunday = @"Sunday";
  
  
  
  if ([DayOfWeek isEqualToString:Monday])
  
  { // Webview code
  
      NSString *urlAddress = @"http://www.google.com";
  
      //Create a URL object.
      NSURL *url = [NSURL URLWithString:urlAddress];
  
      //URL Requst Object
      NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
  
      //Load the request in the UIWebView.
      [webview loadRequest:requestObj];
  
  
  }
  
  else if (dateToday == Tuesday) 
  
  { // Webview code
  
      NSString *urlAddress = @"http://www.cnn.com";
  
      //Create a URL object.
      NSURL *url = [NSURL URLWithString:urlAddress];
  
      //URL Requst Object
      NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
  
      //Load the request in the UIWebView.
      [webview loadRequest:requestObj];
  </code></pre>