Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 字符串操作6位数字用数字替换单位和十位数字_Asp.net_Asp.net Mvc_C# 4.0 - Fatal编程技术网

Asp.net 字符串操作6位数字用数字替换单位和十位数字

Asp.net 字符串操作6位数字用数字替换单位和十位数字,asp.net,asp.net-mvc,c#-4.0,Asp.net,Asp.net Mvc,C# 4.0,我有一个要求,比如,这是一个6位数的数字 第一个循环必须打印如下所示 string str="000000"; StringBuilder sb=new StringBuilder(); int fundCount=0,reportCount=0; For(int i=0;i<9;i++) { sb.Append(str+","); } 第二个循环应该像这样打印 000021 000022 000023 000024 //Here all 2's are fundCount,1,2

我有一个要求,比如,这是一个6位数的数字 第一个循环必须打印如下所示

string str="000000";
StringBuilder sb=new StringBuilder();
int fundCount=0,reportCount=0;
For(int i=0;i<9;i++)
{
   sb.Append(str+",");
}
第二个循环应该像这样打印

000021
000022
000023
000024 //Here all 2's are fundCount,1,2,--9 are report count
000025
000026
000027
000028
000029

我需要打印这样的格式,直到fundcount达到100,并且6位数字保持为6位数字,当fundcount达到10时,它不应该修改为7位数字(我是指2位或3位数字)。请帮我解决这个问题。

可能是我不理解您的请求,但为什么您不能使用string.format?在这种情况下,它将如下所示:

格式(“{0:000000}”,i)

我是你的电话号码

000021
000022
000023
000024 //Here all 2's are fundCount,1,2,--9 are report count
000025
000026
000027
000028
000029