越努力.越幸福.----willingseal.
(一)連接兩個字符串
NSString *type=[ self . type objectAtIndex:typeRow];
NSString *subtype=[self.subtypeobjectAtIndex:subtypeRow];
(1) NSString *typesub = [NSString stringWithFormat:@"%@>%@",type,subtype];
(2) NSString *typesub = [type stringByAppendingString:subtype];
(3) NSString *typesub = [type stringByAppendingFormat:@"%@>%@",type,subtype];
NSLog
(
@"%@"
,typesub);
打印:(1)
交通
>
出租車費
(2)
交通出租車費
(3)
交通交通
>
出租車費
(二)連接三個字符串
NSString *a= @"abc" ;
NSString
*typesub = [type
stringByAppendingFormat
:
@"%@>%@>%@"
,type,subtype,a];
打印:
交通交通
>
出租車費
>abc