C #,ASP.NET
C #,ASP.NET
Showing posts with label
RegularExpressions
.
Show all posts
Showing posts with label
RegularExpressions
.
Show all posts
Monday, May 3, 2010
Split a path into a string[] in C# .net
using System.Text.RegularExpressions;
string inputString = @"C:\somedir\somefile.txt";
string[] parts = Regex.Split(inputString,@"\\");
foreach (string s in parts)
{
// process the strings
}
Answer
s[0]=C:
s[1]= somedir;
s[2]=somefile.txt
Older Posts
Home
Subscribe to:
Posts (Atom)