|
|
Strings
/csbook/solutions/03/A08.cs
using System;
class Test {
static string Strip(string path) {
int pos = path.LastIndexOf('.');
if (pos >= 0) path = path.Substring(0, pos);
pos = path.LastIndexOf('\\');
if (pos >= 0) path = path.Substring(pos+1);
return path;
}
public static void Main(string[] arg) {
foreach (string path in arg) Console.WriteLine(Strip(path));
}
}
|
|