Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. //Rextester.Program.Main is the entry point for your code. Don't change it.
  2. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text.RegularExpressions;
  8.  
  9. namespace Rextester
  10. {
  11.     public class Program
  12.     {
  13.         public static void Main(string[] args)
  14.         {
  15.             //Your code goes here
  16.             string command = @"edit 0:\File with multiple word filename.txt 10 Hello world";
  17.             string path="";
  18.             string line ="";
  19.             string text = "";
  20.             bool dot = false;
  21.             Console.Write(">");
  22.             command=Console.ReadLine();
  23.             string[] array = command.Split(' ');
  24.             int index = 0;
  25.             for(int i=1;i<array.Length;i++)
  26.             {
  27.              if(array[i].Contains('.')==true)
  28.              {
  29.                  path+=array[i]+' ';
  30.                  dot=true;
  31.                  index = i+1;
  32.                  break;
  33.              }
  34.              else
  35.              {
  36.                     path+=array[i]+' ';
  37.              }
  38.              
  39.             }
  40.             line = array[index];
  41.             index++;
  42.             for(int i=index;i<array.Length;i++)
  43.             {
  44.                 text+= array[i]+ ' ';
  45.             }
  46.             Console.WriteLine("FILE NAME: " + path);
  47.             Console.WriteLine("LINE TO EDIT: " + line);
  48.             Console.WriteLine("TEXT: " + text);
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement