SHARE
TWEET

Untitled

a guest Jun 18th, 2018 1,523 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Parser
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("String => ");
  10.             string input = Console.ReadLine();
  11.  
  12.             int lunghezza = input.Length, chars = 0, chars2 = 0;
  13.             char[] charac = new char[1000], other = new char[1000];
  14.            
  15.             for (int i = 0; i < 65; i+=2){
  16.                 charac[i] = Convert.ToChar(input[i]);
  17.                 chars++;
  18.             }
  19.  
  20.             for (int k = 65; k < lunghezza; k++){
  21.                 other[k] = Convert.ToChar(input[k]);
  22.                 chars2++;
  23.             }
  24.  
  25.             int total = chars + chars2;
  26.             string formattata = new string(charac) + new string (other);
  27.  
  28.             Console.WriteLine("Input string {0}\nLength {1}\nFormatted {2}\nLength(should be 60 to be correct) {3}", input, lunghezza, formattata, total);
  29.             Console.ReadLine();
  30.         }
  31.     }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top