FormatNumber in C#

  • Thread starter Thread starter fran
  • Start date Start date
F

fran

Hi!

I need to use a fucntion to format a number in c#, i have
tried to use the FormatNumber function of vb.net, but the
compiler doesn´t recognize it,

Is there any similar function in c#??

Thanks for all
 
fran said:
I need to use a fucntion to format a number in c#, i have
tried to use the FormatNumber function of vb.net, but the
compiler doesn´t recognize it,

Is there any similar function in c#??

Either use String.Format, or int.ToString (assuming it's an int). For
example:

String hex = 23.ToString("x"); // hex is now "17", which is 23 in hex.
 
try something like:

int x = 100;

string myString = x.ToString("0000");


HTH
Brian W



Hi!

I need to use a fucntion to format a number in c#, i have
tried to use the FormatNumber function of vb.net, but the
compiler doesn´t recognize it,

Is there any similar function in c#??

Thanks for all
 
The following function call returns "7,226":

format-number(7226,"#,###")The following function call returns "3458.00":

format-number(3458, "#.00")"fran" <[email protected]>, iletide sunu yazdi

Hi!

I need to use a fucntion to format a number in c#, i have
tried to use the FormatNumber function of vb.net, but the
compiler doesn´t recognize it,

Is there any similar function in c#??

Thanks for all
 
Back
Top