Format a list with dedicated wrapping characters #321
|
Hello, I would like to format a list of strings while wrapping each entry with some character. Thanks in advance! |
Replies: 3 comments
|
The members of the list are prepended with a var result = Smart.Format("{0.Count:choose(0):|{0:list:*{}*|, }}", input);
//
// for input = new List<string> { "one", "two" };
// output: "*one*, *two*"
//
// for input = new List<string>();
// output: "" |
|
First of all, thanks a lot for your prompt answer! This really works well for the latest version, but unfortunately i'm using version I've tried upgrading the version to the latest, but it broke the build since I use the (now deprecated) Could you please suggest what is the way of using "alternative braces" in the newest version? |
|
Try setting |
The members of the list are prepended with a
*and appended with a*. The separator is,.The empty list should give an empty result.
So you could e.g. go for this: