Geoff Lane's predecessor, Brian, had a problem: none of the URLs their dataset started with "http://". This meant that, before displaying them in the UI, Brian would have to figure out a way to take the string "http://", and placed it front of every URL.

Give that requirement, how might you accomplish such a task? Here was Brian's solution ...

static public string PrependProtocol(string urlString) {
    string protocolString = "//:ptth";
    CharEnumerator charEnumerator = 
          protocolString.GetEnumerator();
    while (charEnumerator.MoveNext())
    {
        char padleftChar = charEnumerator.Current;
        urlString = urlString.PadLeft(urlString.Length + 1, padleftChar);
    }
    return urlString;
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!