我加入一個新記錄的XML文件,首先我查詢所有現有的項目,並存儲在int
如何刪除字符並追加字符串?
int number = query.count()
計數,然後由1
number = number + 1;
增加的數量現在我想將這個值格式化爲N00000000
格式 ,並且該數字將佔據最後的位置。
僞代碼:
//declare the format string
sting format = "N00000000"
//calculate the length of number string
int length =number.ToString().Length();
// delete as many characters from right to left as the length of number string
???
// finally concatenate both strings with + operator
???
我去了麻煩製作我自己的擴展方法爲:(。謝謝你的提示。 – 2010-04-24 11:59:03