Advertisement
Guest User

Extract File c#

a guest
Nov 22nd, 2019
436
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace String_Explosions
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.               string[] input = Console.ReadLine().Split("\\\\");
  10.               string file = input[input.Length - 1];  
  11.  
  12.             string fileName = file.Substring(0, file.LastIndexOf("."));
  13.             string fileExtension = file.Substring(file.LastIndexOf('.') + 1);
  14.             Console.WriteLine($"File name: {fileName} \nFile extension: {fileExtension}");
  15.  
  16.  
  17.         }
  18.  
  19.  
  20.        
  21.     }
  22. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement