C# change a 4 or 5 int number to cash value

Joined
Feb 9, 2023
Messages
16
Programming Experience
10+
Good Afternoon,

i have a text file that i parse the example is as shown below,
766,26/01/2021,16:51,6,3,2,Diesel,1249,15120,1888,
768,26/01/2021,17:33,5,1,1,Unleaded,1189,25230,3000,

the end values so 1888
and 3000

are cash values there are a couple of transactions that are in the 100 mark

what i am trying to do is place the the . in the correct place,

so want to turn 1888 to £18.88
and if i have a 100 sale want something like
100.39

but i cant seem to get the normal currency converters to work as i would like,
have tryied the

First Attempt:
            foreach (var data in dataList)
            {
                decimal value = data.Field6;
                Console.WriteLine(value.ToString("C", CultureInfo.CurrentCulture));

                Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture));

            };

that did not work so thought string.format would work,
Attempt 2:
string.Format("{0:0.00}",data.Field6);

but none are working
any help would be much appreciated as i not quite sure how to accomplish this
Kind Regards
Elfenliedtopfan5
 
You've divided it by something that will turn it ti
so want to turn 1888 to £18.88

And you did divide it by 100m?


none are working

That's not how you report an error to a fellow software engineer. Please, never again say "it doesn't work" when talking about a problem in a coding context; it tells us nothing (we already know it doesn't work - you wouldn't be seeking help if it did).

Be clear and specific about why it doesn't work; what do you expect? what do you actually get?

Example: "I expect a string of 18.88, but actually my computer sets on fire"
 

Latest posts

Back
Top Bottom