For more information on integers, see Primitive Data Types.
The following are methods for Integer.
public String format()
Type: String
integer myInt = 22;
system.assertEquals('22', myInt.format());
public static Integer valueOf(String stringToInteger)
Type: Integer
Integer myInt = Integer.valueOf('123');
public static Integer valueOf(Object fieldValue)
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:
List<AccountHistory> ahlist = [SELECT Field,OldValue,NewValue FROM AccountHistory]; for(AccountHistory ah : ahlist) { System.debug('Field: ' + ah.Field); if (ah.field == 'NumberOfEmployees') { Integer oldValue = Integer.valueOf(ah.OldValue); Integer newValue = Integer.valueOf(ah.NewValue); }