C #,ASP.NET
C #,ASP.NET
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
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment