Home > Software engineering >  How to use String format similar to NSString in Flutter?
How to use String format similar to NSString in Flutter?

Time:01-15

How can I use a string format like this with 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)

CodePudding user response:

Something similar in Dart we have String interpolation:

String name = 'John Doe';
int age = 30;

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

More examples: [here](Here in Dart, the programming language that Flutter uses, we have Interpolation:

String name = 'John Doe';
int age = 30;

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

More examples: here

  •  Tags:  
  • Related