如何在 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)
uj5u.com熱心網友回復:
在 Dart 中有類似的東西,我們有字串插值:
String name = 'John Doe';
int age = 30;
String interpolated = 'My name is $name and I\'m $age years old.';
更多示例:這里
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/411618.html
標籤:
