Link to home
Start Free TrialLog in
Avatar of Dynotoe
Dynotoe

asked on

C# - controling the number of decimal places on a string which represents a number with decimals and remainder Zeros etc...

Hi everyone,

Just a quick question.  I have a...

string myNum;

This gets filled with quotes like this...

1.2452
1.2000
1.2470

when there viewed in a gui however they look like this...

1.2452
1.2
1.247

if you notice the last quote drops the remainder zero off.  I need to control the number of decimal places shown.

Is there a string or String method which will keep the remainder zero?  something like
myNum(f4); or something easy.  FYI I can't control when the float or double is converted to the string so I have to operate on the sting afterwards.

Let me express my thanks in advance for your help.

Best,
Dynotoe

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dynotoe
Dynotoe

ASKER

Hi Bob,

Thanks again!

Cheers,

Dynotoe
Avatar of Dynotoe

ASKER

Bob does your example limit the integer part to just 2 places via the ##?