Click here to Skip to main content
15,878,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a function like below which should have 2 inputs a number and a string format

for example


C#
string ConvertnumbertoString(string sFormat,int number)
{
return convertedstring
}


if i call function like this ConvertnumbertoString("$$$$$",281)
then my output should be 00281

some more samples

&&&& 15 = 0015
&&&&& 15 = 00015
$ 15 = 15


How can i do this..please help me
Posted
Updated 22-May-13 5:24am
v2

You should use the ToString extension method for your number formatting.

To String[^]

This has many examples/explanations.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900