Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
整数の出力を指定された長さにパディングする必要があります。
たとえば、長さが4桁の場合、整数4の出力は「4」ではなく「0004」になります。C#2.0でこれを行うにはどうすればよいですか?
string.Format コマンドを使用します。
output = String.Format("{0:0000}", intVariable);
詳細: http://msdn.microsoft.com/en-us/library/fht0f5be.aspx
私はそれがあったと思います: intVal.ToString( "####" );
しかし、ここにいくつかの有用なドキュメントがあります