Top > NSString
[[NSObject]] - [[NSMutableString]] - Objective-c iPhone percent encode a string? -- http://stackoverflow.com/questions/3423545/objective-c-iphone-percent-encode-a-string The iOS 7 SDK now has a better alternative tostringByAddingPercentEscapesUsingEncoding that does let you specify that you want all characters escaped except certain allowed ones. It works well if you are building up the URL in parts: NSString * unescapedQuery = [[NSString alloc] initWithFormat:@"?myparam=%d", numericParamValue]; NSString * escapedQuery = [unescapedQuery stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; NSString * urlString = [[NSString alloc] initWithFormat:@"http://ExampleOnly.com/path.ext%@", escapedQuery]; - C言語の文字const char *とObjectiveCの文字列NSStringの変換 -- http://d.hatena.ne.jp/eidolon/20121125 NSString *str = @"abc"; const char *p = [str UTF8string]; char str_c[100]; strcpy(str_c,"abc"); NSString *str = [ [ NSString alloc ] initWithUTF8String:str ]; |