Instance Method インスタンスメソッド

integer(forKey:)

Returns the integer value associated with the specified key. 指定されたキーと結びつけられた整数値を返します。

Declaration 宣言

func integer(forKey defaultName: String) -> Int

Parameters パラメータ

defaultName

A key in the current user‘s defaults database. 現在のユーザのもつdefaultsデータベースの中のあるキー。

Return Value 戻り値

The integer value associated with the specified key. If the specified key doesn‘t exist, this method returns 0. 指定されたキーと結びつけられた整数値。指定されたキーが存在しないならば、このメソッドは0を返します。

Discussion 議論

This method automatically coerces certain values into equivalent integer values (if one can be determined). The Boolean value true becomes 1 and false becomes 0. A floating point number becomes the greatest integer that‘s less than that number (for example, 2.67 becomes 2). A string that represents an integer becomes the equivalent integer (for example “123“ becomes 123). このメソッドは、自動的に特定の値を同等の整数値へと強制します(もしそれが決定されることが可能ならば)。ブール値trueは、1になります、そしてfalse0になります。浮動小数点値は、その数より小さい最も大きな整数になります(例えば、2.672になります)。ある整数を表す文字列は、同等の整数になります(例えば “123“ は123になります)。

See Also 参照

Getting Default Values defaults値を取得する

Related Documentation 関連文書