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! |
Beta Was this translation helpful? Give feedback.
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: "" |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
Try setting |
Beta Was this translation helpful? Give feedback.
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: