nsstring

Ensure User has entered string in correct format?

Hi, Whats the best way to ensure the user has entered a valid time string such as: 5:24 5.4 102:30 102.5 It will be entered into a UITextField therefore will be in a NSString. I want to allow the user to enter the time in either hours and minutes (hh:mm) or hours and decimal minutes (hh.m). In the hours minutes example they should ...

iPhone - Strike out an NSString

Hi everyone, I would like to know if there is an easy way to strike/cross out some text on the iPhone? Thanks ...

Trouble getting NSString from NSDictionary key into UILabel

I'm attempting to put the value associated with the key called "duration" into a UILabel but I'm getting a blank or "(null)" result showing up in the UILabel. My NSDictionary object with its keys seems to be logging as being full of the data and keys I think I want, as such: the content of thisRecordingsStats is { "12:48:25...

[IPhone] How to get the lenth of each line of the text when wordwrap is considered.

Hi there. I meet a problem as follows: I have a NSString displayed in a UILabel into multiple lines with WordWrap mode = UILineBreakModeWordWrap, rendered into 2 lines NSString* myText = @"I am here Work". "I am here_" //Line 1. _ is for blank. "Work" //Line 2. Is there anyway for me to get the width for the substring 'I am here...

Break NSString using an NSString, get everything after the string that was used to break/separate.

I'm trying to get the DOE,JOHN from the below NSString: IDCHK9898960101DL00300171DL1ZADOE,JOHN I was trying to split the string on 1ZA, as that will be constant. Here's what I've tried so far, but it's giving me the opposite of what I'm looking for: NSString *getTheNameOuttaHere = @"IDCHK9898960101DL00300171DL1ZADOE,JOHN"; // sca...

Global NSString

I need to create an NSString, so I can set its value in one class and get it in another. How can I do it? ...

iPhone - Strike out text for firmware 3.0

Hi everyone, I would like to strike out some text of a UITableView on the iphone firmware 3.0. I posted this one: http://stackoverflow.com/questions/2708732/iphone-strike-out-an-nsstring but didn't get an answer for firmware < 3.2. Thanks ...

NSString - max 1 decimal of a float

Hi everyone, I would like to use a float in a NSString. I used the stringWithFormat and a %f to integrate my float into the NSString. The problem is that I would like to display only one decimal (%.1f) but when there is no decimals I don't want to display a '.0' . How can I do that? Thanks ...

NSString stringWithFormat

Hi Guys, I don't know what I am missing here. I am trying to concatenate strings using NSString stringWithFormat function. This is what I am doing. NSString *category = [row objectForKey:@"category"]; NSString *logonUser = [row objectForKey:@"username"]; user.text = [NSString stringWithFormat:@"In %@ by %@", category, logonUser]; The...

Correct Memory Management for [string UTF8String]

I'm somewhat new to objective-c and I'm not sure what the correct memory management for this code is. const unsigned char * data =(const unsigned char *) [string UTF8String]; When I call free on data I get an error. Do I need to clean up after this call? thanks! ...

Cocoa NSString explode

Hi all, I have a NSString: @"1a,1b,1c,1d,5c". I want this NSString separated into a NSMutableArray, but I don't know how. I think it is fairly simple but I can't find it (maybe because my English isn't good enough to find a good description for it to search on). Regards, Dodo ...

NSString to NSUInteger

Hi all, I've got a number in a NSString @"15". I want to convert this to NSUInteger, but I don't know how to do that... Regards, dodo ...

Need help with UISearchBar and NSString

Hi, I would like to make an if command that checks the value of my UISearchBar in that way if the value of the UISearchBar is equals to " " or multiple spaces without words and chars, an alert will popup. Well, I don't need help with the creation of the alert but I do need help with the if command and the spaces. I know how to do it wit...

iPhone: convert Nsstring to Nsdate on device timezone

hi all, I received date from Web service which is in GMT + 1 format (2010-02-25T20:16:50.387+05:30). I want to convert in NSdate. I have no proper idea about date formatter. Please suggest that how can i Change this nsstring value to current date format (Time zone) ...

How to find out if a method exists in Obj-C when given an NSString

I have a method as an NSString *. If it exists, I want to call it, and if not, do nothing. SEL eventSelector = NSSelectorFromString(eventSelectorStr); if ([delegate respondsToSelector:eventSelector]) { [delegate performSelector:eventSelector]; [delegate adapterDidFinishAdRequest:self]; } else { // Does not implement selector...

How do I pass an NSString through 3 ViewControllers?

hey, I'm currently using the iPhone SDK and I'm having trouble passing an NSString through 3 views I am able to pass an NSString between 2 view controllers but I am unable to pass it through another one. My code is as follows... `- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)index`Path { NSStri...

iPhone simulator app crashes when appending a string

Hi, I'm a complete novice, so I'm probably missing something really easy, but I can't get my string appending to work. I add the 3rd character to typedDigit & it crashes - the method is called fine and typedDigit will get to 2 characters long. I think everything is declared properly in the header file. Code is - -(IBAction)digitPressed...

Date from String using NSDateFormatter regardless 12h-24h setting

Hello everybody, Today my question is about date formats and strings. My application downloads some strings representing dates from the internet. The date format is always like this: "2010-05-24 at 20:45" I need to convert this string into an NSDate object in order to perform some date manipulations. I tried this code: NSString * dateSt...

How do I use the NSString draw functionality to create a UIImage from text

I have an NSString that I would like to draw it's contents to a UIImage but have absolutely NO idea how I would go about doing this. I need to call a method that I give it an NSString and returns a UIImage with the text drawn into it. Please help!! ...

Xcode - EXEC_BAD_ACCESS when concatenting a large string.

I'm getting a EXEC_BAD_ACCESS when concatenting a large string. I've read from a feed and to create my webview I build up my string like: NSString *pageData = @"<h1>header</h1>"; pageData = [pageData stringByAppendingFormat@"<p>"]; pageData = [pageData stringByAppendingFormat@"self.bodyText"]; pageData = [pageData stringByAppendingFor...