Integer Class

Contains methods for the Integer primitive data type.

System

For more information on integers, see Integer Data Type.

The following are methods for Integer.

  • format()

    Returns the integer as a string using the locale of the context user.

  • valueOf(stringToInteger)

    Returns an Integer that contains the value of the specified String. As in Java, the String is interpreted as representing a signed decimal integer.

  • valueOf(fieldValue)

    Converts the specified object to an Integer. Use this method to convert a history tracking field value or an object that represents an Integer value.

Returns the integer as a string using the locale of the context user.

public String format()

Type: String

Returns an Integer that contains the value of the specified String. As in Java, the String is interpreted as representing a signed decimal integer.

public static Integer valueOf(String stringToInteger)

  • stringToInteger:

    Type: String

Type: Integer

A TypeException is returned if you attempt to convert a string to an invalid integer.

Converts the specified object to an Integer. Use this method to convert a history tracking field value or an object that represents an Integer value.

public static Integer valueOf(Object fieldValue)

  • fieldValue:

    Type: Object

Type: Integer

Use this method with the OldValue or NewValue fields of history sObjects, such as AccountHistory, when the field type corresponds to an Integer type, like a number field.

Example: