tags:

views:

71

answers:

1

LotteryAppDelegate *appDelegate = (LotteryAppDelegate *)[[UIApplication sharedApplication] delegate]; Lotterycheck *check;

//NSString *trueval;
 BOOL found = NO;
    NSUInteger f;
for (f = 0; f < [appDelegate.books count]; f++) {



    check = [appDelegate.books objectAtIndex:f];

 checkthis = [NSString stringWithFormat:@"%@", check.LotteryNumber];


 mystring =@"1234567"; //check.LotteryNumber;
 NSString *finel = checkthis;
 NSLog(@"Dynamic Value: %@",finel);
 NSLog(@"Static Value: %@",mystring);

 if ([mystring isEqualToString:finel]) {
        found = YES;
  [self showalert:finel];
        break;

    }

its not comapring the string " if([mystring isEqualToString:finel])" mystring is static value and finel is the value i am getting from the class lotterycheck..

+1  A: 

Assuming that an object belonging to appDelegate.books is of class Book, try the following code snippet.

BOOL found = NO;
NSString *mystring = @"1234567";

for (Book *book in appDelegate.books) {

     NSString *checkthis = [NSString stringWithFormat:@"%@", book.LotteryNumber];

     if ([mystring isEqualToString checkthis]) {
        found = YES;
        [self showalert:checkthis];
        break;

    }
}
unforgiven
Thanks for reply ...LotteryNumber is string ..
Chris