compare NSString and integer?

I have a string that I need to compare with an integer value.

I did this so far :

NSString *rad = [NSString stringWithFormat: @"%@", combo.selectedText];
srchParam.radius = rad;
if (srchparam.radius > 5)
{
    //code here
}

What am I doing wrong ?

Answers


Try this:

if ([combo.selectedText intValue] > 5) {
   //code here
}

Need Your Help

Retrieve latest timestamp row from table using INNER JOIN

php mysql sql

want to retrieve the latest timestamp of the row of name from table. However only the table "location" has the timestamp.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.