I saw something interesting today…

November 17, 2010 § 1 Comment

public string PadString(string value)
{
    if (value.Length == 1)
    {
        return "000000000" + value;
    }
    else if (value.Length == 2)
    {
        return "00000000" + value;
    }
    else if (value.Length == 3)
    {
        return "0000000" + value;
    }
    else if (value.Length == 4)
    {
        return "000000" + value;
    }
    else if (value.Length == 5)
    {
        return "00000" + value;
    }
    else if (value.Length == 6)
    {
        return "0000" + value;
    }
    else if (value.Length == 7)
    {
        return "000" + value;
    }
    else if (value.Length == 8)
    {
        return "00" + value;
    }
    else if (value.Length == 9)
    {
        return "0" + value;
    }
    else
    {
        return value;
    }
}
Advertisements

Tagged:

§ One Response to I saw something interesting today…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading I saw something interesting today… at Mike Vallotton's Blog.

meta

%d bloggers like this: