Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. namespace _03._Extract_File
  2. {
  3.     using System;
  4.  
  5.     class StartUp
  6.     {
  7.         public static void Main()
  8.         {
  9.             string[] input = Console.ReadLine().Split(new char[] { '\\', '.' }, StringSplitOptions.RemoveEmptyEntries);
  10.             string fileName = input[input.Length - 2];
  11.             string extension = input[input.Length - 1];
  12.             Console.WriteLine($"File name: {fileName}");
  13.             Console.WriteLine($"File extension: {extension}");
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement