ICoder
ICoder

Reputation: 1347

How to format or append a string in iPhone?

I want to format the string by this way

NSString *title ;
- (void)uploadString:(NSString *)string
{


            title =glbl.text;
            NSMutableString *strRR = [[NSMutableString alloc] initWithString:title];
            [strRR appendFormat:@"%@ .html"];
            [self.googledocs beginUploadData:dataHtml withTitle:title inFolder:self.adirPath replaceExisting:NO];
}

glbl is the label which holds some values like genesis1.3 and I want to format this string with .html that is genesis1.3.html. stRR is holding the valuegenesis1.3and I want to appendstRRwith.html`. How to do this? I got some error in the above code. Thanks in advance.

Upvotes: 0

Views: 557

Answers (2)

勿绮语
勿绮语

Reputation: 9330

NSString * stRR = [NSString stringWithFormat:@"%@.html", title];

Upvotes: 3

Hot Licks
Hot Licks

Reputation: 47759

I'm guessing that you're having a problem because you're not providing anything to satisfy the format in [strRR appendFormat:@"%@ .html"];

(And it should be stringByAppendingFormat:.)

Upvotes: 1

Related Questions