Last change
on this file since 13918 was
12762,
checked in by aballeit, 9 years ago
|
#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)
|
File size:
1.7 KB
|
Line | |
---|
1 | // <developer>niklas@protocol7.com</developer>
|
---|
2 | // <developer>kevin@kevlindev.com.com</developer>
|
---|
3 | // <completed>100</completed>
|
---|
4 |
|
---|
5 | using System;
|
---|
6 | using System.Text;
|
---|
7 | using System.Text.RegularExpressions;
|
---|
8 |
|
---|
9 | using SharpVectors.Dom;
|
---|
10 |
|
---|
11 | namespace SharpVectors.Dom.Svg
|
---|
12 | {
|
---|
13 | /// <summary>
|
---|
14 | /// This interface defines a list of String objects
|
---|
15 | /// </summary>
|
---|
16 | public sealed class SvgStringList : SvgList<string>, ISvgStringList
|
---|
17 | {
|
---|
18 | #region Constructors
|
---|
19 |
|
---|
20 | public SvgStringList()
|
---|
21 | {
|
---|
22 | }
|
---|
23 |
|
---|
24 | public SvgStringList(string listString)
|
---|
25 | {
|
---|
26 | this.FromString(listString);
|
---|
27 | }
|
---|
28 | #endregion
|
---|
29 |
|
---|
30 | public void FromString(string listString)
|
---|
31 | {
|
---|
32 | // remove existing list items
|
---|
33 | Clear();
|
---|
34 |
|
---|
35 | if (listString != null)
|
---|
36 | {
|
---|
37 | // remove leading and trailing whitespace
|
---|
38 | // NOTE: Need to check if .NET whitespace = SVG (XML) whitespace
|
---|
39 | listString = listString.Trim();
|
---|
40 |
|
---|
41 | if (listString.Length > 0)
|
---|
42 | {
|
---|
43 | Regex delim = new Regex(@"\s+,?\s*|,\s*");
|
---|
44 | foreach (string item in delim.Split(listString))
|
---|
45 | {
|
---|
46 | // the following test is needed to catch consecutive commas
|
---|
47 | // for example, "one,two,,three"
|
---|
48 | if (item.Length == 0)
|
---|
49 | throw new DomException(DomExceptionType.SyntaxErr);
|
---|
50 |
|
---|
51 | AppendItem(item);
|
---|
52 | }
|
---|
53 | }
|
---|
54 | else
|
---|
55 | {
|
---|
56 | AppendItem(String.Empty);
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 | }
|
---|
61 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.