wasSharp – Blame information for rev 7
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
7 | office | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3 // |
||
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
||
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
||
5 | /////////////////////////////////////////////////////////////////////////// |
||
6 | |||
7 | using System; |
||
8 | using System.IO; |
||
9 | using System.Linq; |
||
10 | |||
11 | namespace wasSharp |
||
12 | { |
||
13 | public static class Strings |
||
14 | { |
||
15 | /////////////////////////////////////////////////////////////////////////// |
||
16 | // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // |
||
17 | /////////////////////////////////////////////////////////////////////////// |
||
18 | /// <summary> |
||
19 | /// Combine multiple paths. |
||
20 | /// </summary> |
||
21 | /// <param name="paths">an array of paths</param> |
||
22 | /// <returns>a combined path</returns> |
||
23 | public static string PathCombine(params string[] paths) |
||
24 | { |
||
25 | return paths.Aggregate((x, y) => Path.Combine(x, y)); |
||
26 | } |
||
27 | |||
28 | /////////////////////////////////////////////////////////////////////////// |
||
29 | // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
||
30 | /////////////////////////////////////////////////////////////////////////// |
||
31 | /// <summary> |
||
32 | /// Determines if two strings are equal. |
||
33 | /// </summary> |
||
34 | /// <param name="a">first string</param> |
||
35 | /// <param name="b">second string</param> |
||
36 | /// <param name="comparison">string comparison to use</param> |
||
37 | /// <returns>true if the strings are equal</returns> |
||
38 | public static bool StringEquals(string a, string b, StringComparison comparison) |
||
39 | { |
||
40 | return (a == null && b == null) || (a.Length == b.Length && string.Equals(a, b, comparison)); |
||
41 | } |
||
42 | |||
43 | /////////////////////////////////////////////////////////////////////////// |
||
44 | // Copyright (C) 2016 Wizardry and Steamworks - License: GNU GPLv3 // |
||
45 | /////////////////////////////////////////////////////////////////////////// |
||
46 | /// <summary> |
||
47 | /// Determines if two strings are equal. |
||
48 | /// </summary> |
||
49 | /// <param name="a">first string</param> |
||
50 | /// <param name="b">second string</param> |
||
51 | /// <returns>true if the strings are equal</returns> |
||
52 | public static bool StringEquals(string a, string b) |
||
53 | { |
||
54 | return (a == null && b == null) || (a != null && b != null && a.Length == b.Length && string.Equals(a, b)); |
||
55 | } |
||
56 | } |
||
57 | } |