Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> ListaStudentow = new List<string>();
- ListaStudentow.Add("Kamil_Kwacz_12665");
- ListaStudentow.Add("Andrzej_Gutowski_12442");
- ListaStudentow.Add("Emilia_Wencel_12334");
- ListaStudentow.Add("Ewa_Połomska_123433");
- Program.wyświetl(ListaStudentow, 3);
- Console.WriteLine();
- ListaStudentow = Program.konwerteruj(ListaStudentow);
- Program.wyświetl(ListaStudentow, 2);
- Console.ReadKey();
- }
- static void wyświetl(List<string> lista, int index)
- {
- string[] Dane = lista[index].Split('_',' ');
- if (Dane.Count() == 3)
- Console.WriteLine("Imię : {0} \nNazwisko : {1} \nNumer albumu : {2}", Dane[0], Dane[1], Dane[2]);
- else
- Console.WriteLine("Nazwisko : {0} \nImię : {1}", Dane[0], Dane[1]);
- }
- static List<string> konwerteruj(List<string> lista)
- {
- List<string> ListaDoZwrotu = new List<string>();
- foreach (string Item in lista)
- {
- string[] Dane = Item.Split('_');
- ListaDoZwrotu.Add(Dane[1]+' '+Dane[0]);
- }
- return ListaDoZwrotu;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement