Have defined an array and initialized char a [10]
And NSMutableString * str = [[NSMutableString alloc] initWithString: @ "jack"];
I now want to assign a array str how to do?
Reply:
char cc [10] = {'0 ', '1', '2 ', '3', '4 ', '5', '6 ', '7', '8 ', '9'};
NSString * temp = [NSString stringWithCString: cc];
NSMutableString * str = [[NSMutableString alloc] initWithString: @ "jack"];
[Str appendString: temp];
NSLog (@ "str:% @", str);
[Str release];
Write you an example
Reply:
Upstairs positive solution
Reply:
char cc [10] = {'0 ', '1', '2 ', '3', '4 ', '5', '6 ', '7', '8 ', '9'};
NSString * temp = [NSString stringWithCString: cc];
NSMutableString * str = [[NSMutableString alloc] initWithString: @ "jack"];
[Str appendString: temp];
NSLog (@ "str:% @", str);
[Str release];
Reply:
char cc [10] = {'0 ', '1', '2 ', '3', '4 ', '5', '6 ', '7', '8 ', '9'};
NSString * temp = [NSString stringWithCString: cc encoding: UTF8String];
NSMutableString * str = [[NSMutableString alloc] initWithString: @ "jack"];
[Str appendString: temp];
NSLog (@ "str:% @", str);
[Str release];
No comments:
Post a Comment