101 reputation
1
bio website goo.gl/0fgjx
location Perth, Australia
age 21
visits member for 1 year, 5 months
seen Feb 11 at 8:28
using System;
using System.Text.RegularExpressions;

namespace Millie
{
    static class SentenceString
    {
        public static string ToSentenceCase(this string str)
        {
            var r = new Regex(@"(^[a-z])|\.\s+(.)", RegexOptions.ExplicitCapture);
            return r.Replace(str.ToLower(), s => s.Value.ToUpper());
        }
    }

    class Program
    {
        static string thirdPersonGenderPronoun = "she";
        static string thirdPersonObjectiveGenderPronoun = "her";

        static string[] drinkTypes = { "whiskey", "vodka", "lager", "cider" };
        static string[] timeTypes = { "good", "better" };

        static void drink(string drinkType)
        {
            Console.WriteLine(String.Format("{0} drinks a {1} drink.", thirdPersonGenderPronoun, drinkType).ToSentenceCase());
        }

        static void drinkAll(string[] drinkTypes)
        {
            foreach (string drinkType in drinkTypes)
                drink(drinkType);
        }

        static void sing(string timeType)
        {
            Console.WriteLine(String.Format("{0} sings the songs that remind {1} of the {2} times.", thirdPersonGenderPronoun, thirdPersonObjectiveGenderPronoun, timeType).ToSentenceCase());
        }

        static void singAll(string[] timeTypes)
        {
            foreach (string timeType in timeTypes)
                sing(timeType);
        }

        static void wait()
        {
            Console.ReadKey();
        }

        static void Main(string[] args)
        {
            drinkAll(drinkTypes);
            singAll(timeTypes);
            wait();
        }
    }
}

This user has not answered any questions
This user has not asked any questions
This user has not participated in any tags
Stack Overflow 431 rep 312
Mathematics 196 rep 4
Ask Different 101 rep 1

0 Votes Cast

This user has not cast any votes