浮点数转字符串

浮点数转字符串

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
    }
}

  

posted @ 2023-06-07 16:31  gatran  阅读(43)  评论(0编辑  收藏  举报