Home   Cover Cover Cover Cover
 

Strings

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));
  }
}