Skip to content

Instantly share code, notes, and snippets.

@tearf001
Created March 29, 2019 05:36
Show Gist options
  • Save tearf001/a8d981eb89dfb6ec949f0c5da8dca3ac to your computer and use it in GitHub Desktop.
Save tearf001/a8d981eb89dfb6ec949f0c5da8dca3ac to your computer and use it in GitHub Desktop.
String supplant(String o,map) {
RegExp r = RegExp(r"{([^{}]+)}");
return o.replaceAllMapped(r,(match){
//print('matched;${match.group(1)}');
return '${map[match.group(1)]}';
});
}
main(){
print(supplant('hello,{person},i will {do} u',{'person':'julie','do':['love','then','touch']}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment