wasSharp – Diff between revs 7 and 10
?pathlinks?
Rev 7 | Rev 10 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
Line 6... | Line 6... | |||
6 | |
6 | |
|
7 | using System.Collections.Generic; |
7 | using System.Collections.Generic; |
|
8 | using System.IO; |
8 | using System.IO; |
|
9 | using System.Linq; |
- | ||
10 | using System.Runtime.InteropServices; |
9 | using System.Linq; |
|
Line 11... | Line 10... | |||
11 | using System.Text; |
10 | using System.Text; |
|
12 | |
11 | |
|
13 | namespace wasSharp |
12 | namespace wasSharp |
|
Line 48... | Line 47... | |||
48 | /// <param name="separator">the separator character</param> |
47 | /// <param name="separator">the separator character</param> |
|
49 | /// <param name="escape">the escape character</param> |
48 | /// <param name="escape">the escape character</param> |
|
50 | /// <returns>path parts</returns> |
49 | /// <returns>path parts</returns> |
|
51 | public static IEnumerable<string> PathSplit(this string path, char separator, char? escape) |
50 | public static IEnumerable<string> PathSplit(this string path, char separator, char? escape) |
|
52 | { |
51 | { |
|
53 | Stack<char> s = new Stack<char>(); |
52 | var s = new Stack<char>(); |
|
54 | StringBuilder p = new StringBuilder(); |
53 | var p = new StringBuilder(); |
|
55 | foreach (char c in path) |
54 | foreach (var c in path) |
|
56 | { |
55 | { |
|
57 | if (c == escape) |
56 | if (c == escape) |
|
58 | { |
57 | { |
|
59 | s.Push(c); |
58 | s.Push(c); |
|
60 | continue; |
59 | continue; |