• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

500pts: Using String.Format to format a string ??

Hi there,

Can anyone help?

I have a string but it contains numbers i.e. 3000000

I would like to format it to 3,000,000 but remembering it isn't a integer ... it is already a string,

I did try this, Console.WriteLine(String.Format("{0:n}",row["NUM"].ToString()));

But it still returns 3000000

Should i convert it to an integer first or something? can it not work on strings????

Thanks in advance

Ian
0
ianinspain
Asked:
ianinspain
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
How about:

   Console.WriteLine("{0:#,###,###}", Int32.Parse(val));
0
 
ianinspainAuthor Commented:
cool! thanks...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now