共用方式為


Int64.From

語法

Int64.From(value as any, optional culture as nullable text, optional roundingMode as nullable number) as nullable number

關於

根據指定的 value 傳回 64 位元整數 number 值。 如果指定的 valuenull,則 Int64.From 會傳回 null。 如果所指定 value 是在 64 位元整數範圍內且沒有小數部分的 number,則會傳回 value。 如果有小數部分,則會使用指定的四捨五入模式來進位。 預設四捨五入模式為 RoundingMode.ToEven。 如果 value 是任何其他類型,則會先使用 Number.FromText 轉換成number。 如需可用的四捨五入模式,請參閱 Number.Round。 也可以提供選擇性的 culture (例如,"en-US")。

範例 1

取得 "4" 的 64 位元整數 number 值。

使用方式

Int64.From("4")

輸出

4

範例 2

使用 RoundingMode.AwayFromZero 以取得 "4.5" 的 64 位元整數 number 值。

使用方式

Int64.From("4.5", null, RoundingMode.AwayFromZero)

輸出

5