Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. List<string> ListaStudentow = new List<string>();
  14. ListaStudentow.Add("Kamil_Kwacz_12665");
  15. ListaStudentow.Add("Andrzej_Gutowski_12442");
  16. ListaStudentow.Add("Emilia_Wencel_12334");
  17. ListaStudentow.Add("Ewa_Połomska_123433");
  18.  
  19. Program.wyświetl(ListaStudentow, 3);
  20. Console.WriteLine();
  21.  
  22. ListaStudentow = Program.konwerteruj(ListaStudentow);
  23. Program.wyświetl(ListaStudentow, 2);
  24. Console.ReadKey();
  25. }
  26.  
  27. static void wyświetl(List<string> lista, int index)
  28. {
  29. string[] Dane = lista[index].Split('_',' ');
  30.  
  31. if (Dane.Count() == 3)
  32. Console.WriteLine("Imię : {0} \nNazwisko : {1} \nNumer albumu : {2}", Dane[0], Dane[1], Dane[2]);
  33.  
  34. else
  35. Console.WriteLine("Nazwisko : {0} \nImię : {1}", Dane[0], Dane[1]);
  36.  
  37. }
  38.  
  39. static List<string> konwerteruj(List<string> lista)
  40. {
  41. List<string> ListaDoZwrotu = new List<string>();
  42.  
  43. foreach (string Item in lista)
  44. {
  45. string[] Dane = Item.Split('_');
  46. ListaDoZwrotu.Add(Dane[1]+' '+Dane[0]);
  47. }
  48. return ListaDoZwrotu;
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement