How can I place zeroes to the left of a given number to a maximum of 6 digits including the given nu
Posted
by Sergio Tapia
on Stack Overflow
See other posts from Stack Overflow
or by Sergio Tapia
Published on 2010-06-14T00:04:44Z
Indexed on
2010/06/14
0:12 UTC
Read the original article
Hit count: 334
I have this method that receives an ID number and downloads an HTML website according to that ID.
Typically, an IMDB link is like this:
http://www.imdb.com/title/tt0892791/
http://www.imdb.com/title/tt1226229/
http://www.imdb.com/title/tt0000429/
They all follow the 'tt' then 7 digits, with lack of digits turning into zeroes to fill out the left spaces.
How can I accomplish this using C#? I'm kind of stumped.
Here's my method:
/// <summary>
/// Find a movie page using its precise IMDB id.
/// </summary>
/// <param name="id">IMDB Movie ID</param>
/// <returns>Returns an HtmlDocument with the source code included.</returns>
public HtmlDocument ByID(string id)
{
string url = String.Format("http://www.imdb.com/title/tt{0}/", id);
HtmlDocument page = downloader.Load(url);
return page;
}
Thank you very much for your time, and if you are interested in helping out, you can check out the complete source code of TheFreeIMDB here: http://thefreeimdb.codeplex.com/
© Stack Overflow or respective owner