Newbie here in C#..
I am creating a calculator, and would like to display my numbers through UI text elements. Problem is that i want to limit my number to say, 4 decimals like 10.4812
I tried with Tostring("F4"), which works, but then when i have a round number like 12, it will display "12.0000", which is ugly.
What would be the simplest way to achieve this ? I thought of complicated ways, like converting my ui element.text into a char array, then detecting the ".", counting 4 digits and removing the rest, but that sounds crazy maybe ?
It has happened many times that i was trying too insane things when something simple was existing, so i thought it was worth asking :D.
Thanks in advance!