When the number is treated base-10, conversion stops when a non-numeric character is encountered : parseInt « Data Type « Flash / Flex / ActionScript






When the number is treated base-10, conversion stops when a non-numeric character is encountered

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        // The number is treated as a decimal, not a hexadecimal number
        trace(parseInt("0x12", 10));   // Displays: 0 (not 12 or 18)
    }
  }
}

        








Related examples in the same category

1.Parse the numbers from the string in base-2 (binary)
2.Parse the numbers from the string base-16 (hexadecimal)
3.Parse the numbers from the string base-10
4.If omitted, the radix is assumed to be 10, unless the string starts with 0x, 0X, or 0
5.Octal is treated as a decimal number, not an octal number: