Esempio n. 1
0
        private static string RotatePhrase(string phrase, int number_rotations, IShifter shifter)
        {
            string phraseWithoutSpaces = RemoveSpaces(phrase);

            phraseWithoutSpaces = shifter.Shift(phraseWithoutSpaces, number_rotations);
            return(PutSpacesBackInPlace(phrase, phraseWithoutSpaces));
        }
Esempio n. 2
0
        private static string RotateWords(string phrase, int number_rotations, IShifter shifter)
        {
            List <string> words = GetListOfWordsIn(phrase);

            for (int position = 0; position < NumberOf(words); position++)
            {
                if (HasMoreThanOneLetter(words[position]))
                {
                    words[position] = shifter.Shift(words[position], number_rotations);
                }
            }
            return(JoinWords(words, SPACE));
        }