浮点数转字符串
using UnityEngine; public class Juse : MonoBehaviour { float a = 2; float b = 6666.6666f; void Start() { Debug.Log(a.ToString("#00"));//输出:02 Debug.Log(a.ToString("#00.00"));//输出:02.00 Debug.Log(b.ToString("#00"));//输出:6667 Debug.Log(b.ToString("#00.00"));//输出:6666.67 } }
标签:输出,Log,浮点数,Debug,ToString,字符串 From: https://www.cnblogs.com/gatran/p/17463800.html