How to delete characters and append strings?

Posted by devin250 on Stack Overflow See other posts from Stack Overflow or by devin250
Published on 2010-04-24T11:50:35Z Indexed on 2010/04/24 11:53 UTC
Read the original article Hit count: 304

Filed under:
|

i am adding a new record to xml file

im first quering all existing items and storing the count in an int

int number = query.count()

and then incrementing number by 1;

number = number +1;

now i want to format this value in a string having "N00000000" format and the number will ocuppy the last positions

Pseudo code:

//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
???

help please

© Stack Overflow or respective owner

Related posts about c#

Related posts about string-manipulation