Beispiel #1
0
        void FormatDefault()
        {
            #region MassTypeDemo2_FormatDefault
            Debug.Log(MassType.Format(1.0));
            // Prints: "1.0 t"
            Debug.Log(MassType.Format(1.567));
            // Prints: "1.57 t"
            Debug.Log(MassType.Format(10.0));
            // Prints: "10 t"
            Debug.Log(MassType.Format(10.56));
            // Prints: "10.6 t"
            Debug.Log(MassType.Format(100.0));
            // Prints: "100 t"
            Debug.Log(MassType.Format(100.5));
            // Prints: "101 t"

            Debug.Log(MassType.Format(0.1234567));
            // Prints: "124 kg"
            Debug.Log(MassType.Format(0.0123456));
            // Prints: "12.4 kg"
            Debug.Log(MassType.Format(0.0012345));
            // Prints: "1.24 kg"

            Debug.Log(MassType.Format(0.0001234567));
            // Prints: "124 g"
            Debug.Log(MassType.Format(0.0000123456));
            // Prints: "12.4 g"
            Debug.Log(MassType.Format(0.0000012356));
            // Prints: "1.24 g"
            Debug.Log(MassType.Format(0.0000001235));
            // Prints: "0.124 g"
            #endregion
        }
Beispiel #2
0
 void FormatFixed()
 {
     #region MassTypeDemo2_FormatFixed
     Debug.Log(MassType.Format(0.12345678, format: "0.0000"));
     // Prints: "0.1235 t"
     Debug.Log(MassType.Format(0.12345678, format: "0.00"));
     // Prints: "0.12 t"
     Debug.Log(MassType.Format(0.12345678, format: "0.0000", scale: 0.001));
     // Prints: "123.4568 kg"
     Debug.Log(MassType.Format(0.12345678, format: "0.0000", scale: 0.000001));
     // Prints: "123456.7800 g"
     #endregion
 }