Raizekas

Untitled

Jan 26th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1.  static string RikiuotaEilutė(string rezultatuEilute)
  2.         {
  3.             char rikiuota=' ';
  4.             string alfabetas = "aąbcčdeęėfghiįyjklmnoprsštuųūvzž";
  5.             char[] rezultatass = rezultatuEilute.ToCharArray();
  6.  
  7.             for (int i = 0; i < rezultatass.Length-1; i++)
  8.             {
  9.                 for(int j=i+1; j<rezultatass.Length; j++)
  10.                 {
  11.                     if (alfabetas.IndexOf(rezultatass[i]) > alfabetas.IndexOf(rezultatass[j]))
  12.                     {
  13.                         if (alfabetas.IndexOf(rezultatass[i]) != -1 && alfabetas.IndexOf(rezultatass[j]) != -1)
  14.                         {
  15.                             rikiuota = rezultatass[i];
  16.                             rezultatass[i] = rezultatass[j];
  17.                             rezultatass[j] =rikiuota;
  18.                         }
  19.                     }
  20.                 }
  21.             }
  22.             return rezultatass.ToString();
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment