[Mono-list] Re: Remote Compiling
Serge
serge@wildwestsoftware.com
Fri, 17 Aug 2001 22:40:05 +0400
> > "C:\Some\Where\Source.cs" or "/home/someone/Source.cs" -> "Source.cs"
> Yeah, I looked at all the Regexp class documentation, it's just too sparse
> or too well hidden for me to find a basic enough overview.
The following snippet will do the job:
string path = "C:\\Some\\Where\\Source.cs";
string s1 = Regex.Replace(path, "[\\s\\S]*[\\\\/]" ,"");
As it was noted previously, it' possible to use String.Split,
but the resulting code is somewhat ugly:
string [] sa=Regex.Replace(path,"/","\\").Split('\\');
string s2 = sa [sa.Length - 1];
----
Serge