Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- string napis = "sdaaaa.ssssssssssd.aaaaaaaa.d";
- string[] podzielony = Podziel(napis, '.');
- for (int i = 0; i < 4; i++)
- {
- Console.WriteLine(podzielony[i]);
- }
- Console.ReadKey();
- }
- static string[] Podziel(string napis, char delimeter)
- {
- int l = 0, rozmiarTablicy = 1, pierwszaLitera = 0;
- while (l < napis.Length)
- {
- if (napis[l] == delimeter) rozmiarTablicy++;
- l++;
- }
- string[] podzielony = new string[rozmiarTablicy];
- for (int i = 0, j = 0; i < napis.Length; i++)
- {
- if (napis[i] == delimeter)
- {
- string nowy = null;
- for (int k = pierwszaLitera; k < i; k++)
- {
- nowy += napis[k];
- }
- pierwszaLitera = i+1;
- podzielony[j] = nowy;
- j++;
- }
- }
- return podzielony;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement