CSharp: How to format a double value according to culture-specific formatting in Unity C#

using System.Collections.Generic;
using System.Globalization;

public class ExampleFormatDoubleValues : MonoBehaviour

double inputValueDouble = 79.00;

string outputValueDoubleString = string.Format(CultureInfo.InvariantCulture, "{0}", inputValueDouble);

// Output according to different cultures
// if culture is en-US then output is 79.00
// if culture is de-DE then output is 79,00




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Software Engineer (Android, iOS, Unity) | M.Sc. Computer Science — Technische Universitaet Berlin | Mobile Advertising, Attribution, Monetisation, UA & Analytic