-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelper.cs
45 lines (41 loc) · 1.13 KB
/
Helper.cs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Collections.Generic;
namespace MsBuildDebugger
{
public static class Helper
{
/// <summary>
/// Split a list literal into its items and remove any whitespace surrounding the items.
/// </summary>
public static IEnumerable<string> SplitValue(string val)
{
val = val.Replace("\r\n", ";");
var split = val.Split(';');
var result = new List<string>();
for(var i = 0; i < split.Length; i++)
{
var trimmed = split[i].Trim();
if (!string.IsNullOrEmpty(trimmed))
{
result.Add(trimmed);
}
}
return result;
}
public static string AlignStringInSpace(string input, int space, HorizontalAlignment alignment)
{
var result = input;
if (input.Length > space)
{
result = input.Substring(0, space - 3) + "...";
}
return result;
}
}
public enum HorizontalAlignment
{
Left,
Center,
Right
}
}