Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private bool _isFirstAlphabetical(string actual, string next)
- {
- if (actual.Length < next.Length)
- {
- for (int stringIndex = 0; stringIndex < actual.Length; ++stringIndex)
- {
- if (Char.ToLower(actual[stringIndex]) > Char.ToLower(next[stringIndex]))
- return true;
- else if (actual[stringIndex] == next[stringIndex])
- continue;
- else
- return false;
- }
- return false;
- }
- else
- {
- for (int stringIndex = 0; stringIndex < next.Length; ++stringIndex)
- {
- if (Char.ToLower(actual[stringIndex]) > Char.ToLower(next[stringIndex]))
- return true;
- else if (actual[stringIndex] == next[stringIndex])
- continue;
- else
- return false;
- }
- return false;
- }
- }
- public string[] podleAbecedy()
- {
- string[] words = this.getSlova();
- for (int i = 0; i < words.Length; ++i)
- {
- for (int j = 0; j < words.Length - 1; ++j)
- {
- string temp;
- if (_isFirstAlphabetical(words[j], words[j + 1])) // tady se vola ta privatni fce nahore
- {
- temp = words[j];
- words[j] = words[j + 1];
- words[j + 1] = temp;
- }
- }
- }
- return words;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement