Exemplo 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));
        }
Exemplo 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));
        }
Exemplo n.º 3
0
 protected internal void resetShifter() => shifter = ShiftFactory.CreateByIndex(size);