string to int apex code example Example: cast string to integer apex Integer i; String s; s='10'; i=integer.valueof(s);