-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathExtensions.cs
55 lines (48 loc) · 1.94 KB
/
Extensions.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
46
47
48
49
50
51
52
53
54
55
namespace CIFARLoader
{
/// <summary> An extensions. </summary>
internal static class Extensions
{
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> A string extension method that trim null. </summary>
///
/// <param name="t"> The t to act on. </param>
///
/// <returns> A string. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
public static string TrimNull(this string t)
{
return t.Trim((char)0x20, (char)0x00);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> A string extension method that trim slash. </summary>
///
/// <param name="t"> The t to act on. </param>
///
/// <returns> A string. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
public static string TrimSlash(this string t)
{
return t.TrimEnd('/');
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> A string extension method that trim volume. </summary>
///
/// <param name="t"> The t to act on. </param>
///
/// <returns> A string. </returns>
////////////////////////////////////////////////////////////////////////////////////////////////////
public static string TrimVolume(this string t)
{
if (t.Length > 3 && t[1] == ':' && t[2] == '/')
{
return t.Substring(3);
}
if (t.Length > 2 && t[0] == '/' && t[1] == '/')
{
return t.Substring(2);
}
return t;
}
}
}