%1$@
%2$@
%1$d
%2$d
OC section of code that is similar in other languages
NSString *total = @"10";
NSString *sub = @"3";
NSString *enStr = @"%@ of %@";
NSString *chStr = @"%2$@ 个中的 %1$@ 个";
NSString *egLishString = [NSString stringWithFormat:enStr,sub,total];
NSLog(@"%@", egLishString); // 3 of 10
NSString *chLishString = [NSString stringWithFormat:chStr,sub,total];
NSLog(@"%@", chLishString); //10 个中的 3 个
- Digital placeholder indicates that the filling position of several parameters
[NSString stringWithFormat:@"%2$@ 个中的 %1$@ 个", sub, total]
- Placeholder character to indicate that the position of the filling parameters Type
@: Object Type, D: integer, S: String, ...