Formatメソッド(数値の書式指定)
リスト6-32
Function Download(ByVal id As Integer) As ActionResult
'サンプル例:DSC04072.jpg
Dim num As String = String.Format("{0:D5}", id) '出力例"00001"
Dim pic = Server.MapPath(String.Format("~/App_Data/Photos/DSC{0}.jpg", num))
If System.IO.File.Exists(pic) Then
Return File(pic, "image/jpeg", String.Format("DSC{0}.jpg", num))
End If
Return HttpNotFound("File does not exist.")
End Function
参考
//数値を右詰めや0埋めで文字列化するには
http://www.atmarkit.co.jp/fdotnet/dotnettips/116formatint/formatint.html