Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there anyway to format a set of items when format could also change
    primarykey
    data
    text
    <p>My problem is really more complicated but I have simplified it to allow easy explanation. </p> <p>Suppose you need to write an string in different languages but you need to show a collection of items and possible the amount of this items, but you don't know the exact amount of them.</p> <p>Let's take usernames, [user1,user2,user3,user4] </p> <p>I want to produce this... "Hello to user1, user2, user3 and user4, our new 4 user(s) in last hour"</p> <p>I want to define something like this... Hello to {item(1)} {, item(2..n-1)} and {item(n)} our new {count} user(s) in last hour.</p> <p>The idea is to repeat items from 2 to n-1 to produce the comma separated values, and then add the fixed ones. {count} is a predefined variable, could be others (until now thinking that need to be fixed names).</p> <p>The idea is to allow easy changes of formats to allow internationalization later or other things.</p> <p>If you couldn't understand anything please ask... </p> <p>What is the best approach to solve this in .Net?</p> <p>thanks. </p> <h2>Update</h2> <p>The main idea is to allow change the way the data is displayed, suppose I want now to show the user in different lines (I can modify the format in database for that message) </p> <p>Hello to our new {count} user(s) in last hour {item(1.n-1) /br} {item(n)}. </p> <p>Maybe the formatting is bad, I am just trying to get ideas.</p> <h2>Update</h2> <p>Ok let's put another example to show what i am looking for, there is a collection of users, but actually i don't know how they should look, the format show be inside this tags {} or everthing else we can imagine. Another more complex example.</p> <p>Hello to to our new {count} users. </p> <pre><code>{&lt;div class="some class"&gt;item(2..n)&lt;/div&gt;} </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload