在Objective C中,是否有一种类似于python's
str.format
方法的格式化字符串的方式。我想要能够使用一些字典@{@"keyword_2": @"bar", @"keyword_1": @"foo"}
替换带有关键字@"this is {keyword_1}, and this is {keyword_2}"
的字符串,并生成一个新的字符串@"this is foo, and this is bar"
。在Objective C中,这可能看起来像这样:[NSString stringWithKeywordFormat:@"hello {user_name}, today is {day_of_week}!" keywords:@{@"user_name":@"Jack", @"day_of_week":@"Thursday"}];