-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
32 lines (21 loc) · 979 Bytes
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Hello World.
Hi, this is a small library to convert lists of the form A, B, C to a string A, B, and C. Its also handles singular/plural prefixes/suffixes.
<pre>
var items = "Red || Green || Blue || Orange || Yellow";
var separator = new string[] { "||" };
IStringListProvider provider = new FlatStringListProvider(items, separator);
var options = new NaturalLanguageListOptions();
options.PrefixPlural = "are";
options.PrefixSingular = "is a";
options.SuffixPlural = "stickers";
options.SuffixSingular = "sticker";
options.Separator = ",";
options.LastSeparator = "and";
var languageList = languageHelper.NaturalLanguageList(options, provider);
var sentence = "There are " + languageList + " for you on the table"
Console.Writeline(sentence);
Output:
There are red, green, blue, orange, and yellow stickers for you on the table.
<pre>
See the console demo for more example usage
Tests included.