NSString memory leak
//opening DB if(sqlite3_step(statement) == SQLITE_ROW) result = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement,0)]; //! else result nil; return result; //close DB ...
//opening DB if(sqlite3_step(statement) == SQLITE_ROW) result = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement,0)]; //! else result nil; return result; //close DB ...
I have a very long text, I defined it as NSString, so I need paging, there will be different paging for different fonts, say I'd like to display one page on a multiple line UILabel. So at frist I need to get substring of page by page of the long string. Does anyone know good solution for this? Thanks in advance. I know there is a NSStr...
Hi, So I am new to iphone development, but am trying to learn how to take a file that is CSV and read it and save it using Core Data (I think that is the best way?) so that I can display it in a tableview on the iphone. Below is an example of the type of csv file I am working with; 13,1,1,History,,,,,,1 ,263,1,Smith,Bob,Freshman ,317,...
I think this is a quick question and answer - I'm reading a dictionary entry for a detail view which is pushed from a tableview row. but in the detail view, when I'm picking up the data to display (as an HTML page) I'm getting the message: incompatible Objective-C types initializing 'struct NSDictionary *'. expected 'struct NSString *' C...
Hi everybody ! Can someone help me ? I have a NSString with @"12.34" and I want to convert it into a NSString with the same float number but in single precision 32bits binary floating-point format IEEE-754 : like @"\x41\x45\x70\xa4" (with hexa characters) or @"AEp¤"... I'm sure it's something easy but after many hours of reading the doc...
I've been searching for an answer to this question on google and some other forums, but I haven't found the answer yet. It seems like a simple enough question: how do I manually insert a newline into UITextView's text field? If it matters, I'm reading my string from an SQLite database. That means that I'm translating a const char (I thi...
I'm attempting conversion of a legacy C++ program to objective-C. The program needs an array of the 256 possible ASCII characters (8-bits per character). I'm attempting to use the NSString method initWithBytes:length:encoding: to do so. Unfortunately, when coded as shown below, it crashes (although it compiles). NSString* charass...
I have a UILabel called optionsDisplayerBrushSizeLabel who's text property I want to set to a CGFloat: brushSizeVal. I understand that the text property needs to be a string but I don't know how to convert a CGFloat to an NSString. ...
Hi all, I'm doing a very simple trimming from a string. Basically it goes like this: int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *s = [[NSString alloc] initWithString:@"Some other string"]; s = [s stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceA...
Hi, it may be very easy, but I don't seems to find out why is URLWithString: returning nil here. //localisationName is a arbitrary string here NSString* webName = [localisationName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString* stringURL = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@,Mon...
I have multiple NSStrings and i wish to merge them into one other, here is my code so far... NSString *newURL = [_parameters objectForKey:@"url"]; NSString *emailBody = @"Hey!<br>I just snipped my long url with <a href=\"http://itunes.com/app/SnippetySnip\">Snippety Snip for iPhone</a> in just a few seconds, why not check it out?<p><...
How do I get a NSString's size as if it drew in an NSRect. The problem is when I try -[NSString sizeWithAttributes:], it returns an NSSize as if it had infinite width. I want to give a maximum width to the method. Is there any way of doing so? (BTW: Mac OS, not iPhone OS) Thanks, Alex ...
In my app I have a UILabel which is the title and a UITextView which is the description and I want the title UILabel to be the first word typed into the UITextView. Does anyone know how to do this? ...
How would I go about getting a string from a UITextField in the iPhone SDK? I'm trying to insert it into another concatenated string. ...
Hey there, I have an NSMutableArray of objects. Each object has a property called "Name". I want to join them together in a string with a separator " > ". So if the name property in each of the objects in my array is "one", "two" and "three" respectively, the result would be "one > two > three". Thanks, howie ...
I'm trying to join an array of objects into a string that will ultimately be used to populate the detail label of a table cell. if the text is too long it will automatcally truncate and add an elipse at the end. I want to avoid this by checking that the string is less than say 40 characters and adding an elipse in the middle instead. ...
Possible Duplicate: iphone how to check that a string is numeric only I have one NSString, then i want check the string is number or not. I mean NSString *val = @"5555" ; if(val isNumber ){ return true; }else{ retun false; } How can I do this in Objective C? ...
Hello Everyone! How can i do this? I know ho to do this on windows, but here.. im newer )) SDK: Mac OS X 10.5 ...
I'm writing a property list to be in the resources bundle of my application. An NSString object in the plist needs to have line-breaks in it. I tried \n, but that doesn't work. What do I do to have newlines in my string in the plist? Thanks. ...
Both work, but... Which one would you use and why ? @implementation NSString (Extender) -(NSString *) stringByTrimmingPrefix:(NSString *)strPrefix { while ([self hasPrefix:strPrefix]) { self = [self substringFromIndex:strPrefix.length]; } return self; } @end or @implementati...