how to validate string in NSUserdefaults
<p>i am getting some id from the web services.</p>

<p>eg:101.</p>

<p>that id i am save in NSUserdefaults and give that value to the string.</p>

<p>Now i need to validate that string like if that string is equal to 0 i need to fire one action and if that value is not equal to 0 i need to fire another action.</p>

<p>for that my code is like this.</p>

<pre><code>NSLog(@"id is%@",[defaults objectForKey:@"id"]);
NSString *intString = [NSString stringWithFormat:@"%d", [defaults objectForKey:@"id"]];

NSLog(@"string %@",intString);
if ([intString isEqualToString:@"0"]) {
    NSLog(@"yes  it is 0");
}
else {
   NSLog(@"No it not eqal to zero");
}
</code></pre>

<p>for the first time in console id is 0,string is 0</p>

<p>And if i check second time   id is 0, string is 100243248.</p>

<p>i did n't get what this 100243248 value.</p>

<p>I need to check id in NSUserdefaults. if that value is 0 i need to fire one action and if that value is not equal to zero i need to fire another action.</p>

<p>how can i done can any one please help me.</p>

<p>Thank u in advance.   </p>

<hr>
