Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _03._Extract_File2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string inputLine = Console.ReadLine();
- string[] fileNameAndExtention = GetFileName(inputLine).Split('.').ToArray();
- Console.WriteLine("File name: " + fileNameAndExtention[0]);
- Console.WriteLine("File extension: " + fileNameAndExtention[1]);
- }
- static string GetFileName(string input)
- {
- string rezult;
- int nameStartIndex = input.LastIndexOf('\\') + 1;
- rezult = input.Substring(nameStartIndex, input.Length - nameStartIndex);
- return rezult;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment