如何在Flutter中使用类似NSString的字符串格式



如何在Flutter中使用这样的字符串格式?

static let sampleText  = “Stack Overflow is a user-oriented question and answer site about computer programming. Located within the Stack Exchange sites, Stack Overflow was founded in 2008 by %@ and %@”
NSString(format: sampleText, Jeff Atwood, Joel Spolsky)

Dart中有类似的字符串插值:

String name = 'John Doe';
int age = 30;
String interpolated = 'My name is $name and I'm $age years old.';

更多示例:此处

最新更新