parseint Questions

4

Solved

today I stumbled on a strange (in my opinion) case in JavaScript. I passed a non-hexadecimal string to the parseInt function with the base of 16 and...I got the result. I would expect the function ...
Dinghy asked 24/9, 2014 at 12:50

3

Solved

I have the following two parseInt() and I am not quite sure why they gave me different results: alert(parseInt(0.00001)) shows 0; alert(parseInt(0.00000001)) shows 1 My guess is that since parse...
Homeland asked 19/4, 2014 at 20:49

1

Solved

Found out a strange thing in IE8: parseInt('01') //1 parseInt('02') //2 parseInt('03') //3 /*...*/ parseInt('07') //7 parseInt('08') //0 !!! parseIntr('09') //9 ok Can someone clarify?
Alcoholism asked 26/9, 2013 at 15:41

9

Solved

int i = 0; int k = Integer.parseInt("12"); int j = k; System.out.println(i+1 + " " + j+1); Strangely the output received is 1 121 I can not figure out this basic difference. Please help me.
Orison asked 13/6, 2012 at 5:11

4

Solved

Why does this part of code fail: Integer.parseInt("11000000000000000000000000000000",2); Exception in thread "main" java.lang.NumberFormatException: For input string: "110000000000000000000000000...
Mandrake asked 17/1, 2012 at 2:25

4

Solved

Alright...I have this .txt file (UTF-8) 4661,SOMETHING,3858884120607,24,24.09 4659,SOMETHING1,3858884120621,24,15.95 4660,SOMETHING2,3858884120614,24,19.58 And this code FileInputStream fis = n...
Ranunculaceous asked 4/1, 2011 at 22:19

1

Solved

I just noticed that: //IN CHROME JS CONSOLE parseInt("03010123"); //prints: 3010123 //IN NODE.JS parseInt("03010123"); //prints: 790611 Since both are based on V8, why same operation yielding d...
Sperling asked 2/6, 2013 at 6:20

3

I made a form where the user inputs values for width and height that they want for the pop up window to be. I am using window.open for that. So I think I need to check if the values for width and...
Conative asked 5/9, 2010 at 9:1

3

Solved

I have a String and an int, lets say: String str = "12345"; and int num = 12345;. What is the fastest way of seeing if they are the same, str.equals("" + num) or num == Integer.parseInt(str) (Or is...
Amygdalate asked 13/4, 2013 at 5:31

7

Solved

I was wondering if anyone had put together something or had seen something equivalent to the JavaScript parseInt for C#. Specifically, i'm looking to take a string like: 123abc4567890 and retur...
Denitadenitrate asked 10/6, 2009 at 13:8

4

Solved

Which rule do I have to follow when extracting numbers out of DOM and calcluation with them? How does javascript knows that a value is a number or not? Should I always use parseInt? Given followin...
Filmore asked 15/3, 2013 at 10:3

8

As far as I understand in java a function which throws an exception should not be compiled without a try and catch or a deceleration in the function above it. How come then this code is legitimate ...
Ninos asked 10/1, 2013 at 10:36

3

Solved

I have allready compiled a few tiny programms in java and everything was fine. But my new code has any problem. class myclass { public static void main (String[] args) { int x, y; String s ="s...
Cameraman asked 17/11, 2012 at 23:6

5

Solved

Possible Duplicate: Is JavaScript’s Math broken? In Javascript, I cannot figure out why 230/100*100 returns 229.99999999999997, while 240/100*100 returns 240. This also applies to 46...
Capsaicin asked 6/11, 2012 at 9:34

6

Solved

How to parseInt "09" into 9 ?
Gegenschein asked 9/10, 2009 at 17:48

1

Solved

Possible Duplicate: Workarounds for JavaScript parseInt octal bug I am working on javascript, and I seem to find this strange, that the javascript function parseInt('08') is returning...
Eadwine asked 2/8, 2012 at 22:28

4

Solved

I have an annoying problem in JavaScript. > parseInt(1 / 0, 19) > 18 Why does the parseInt function return 18?
Ina asked 5/7, 2012 at 8:37

7

Solved

I am making a web-based application and i have text-fields where the values are stored as Strings. The problem is that some of the text-fields are to be parsed into ints and you can store much bigg...
Edvard asked 19/6, 2012 at 14:19

1

Solved

How would I round off a value from a textfield with a parseFloat result in it? This application basically sums up the value of all radio buttons when clicked and displays the sum in a textbox. The...
Healall asked 29/3, 2012 at 17:31

2

Solved

I'm trying to parse a int from a String array element. Here is my code: String length = messageContents[k].replace("Content-Length:", "").replace(" ", ""); System.out.println("Length is: " + lengt...
Ferro asked 16/1, 2012 at 13:19

3

Solved

While playing around with random numbers in JavaScript I discovered a surprising bug, presumably in the V8 JavaScript engine in Google Chrome. Consider: // Generate a random number [1,5]. var rand...
Skirting asked 8/9, 2011 at 19:46

3

Solved

Possible Duplicate: Truncate leading zeros of a string in Javascript What is the simplest and cross-browser compatible way to remove leading zeros from a number in Javascript ? e.g. ...
Haskell asked 13/7, 2011 at 8:59

6

Solved

Alright, so I was messing around with parseInt to see how it handles values not yet initialized and I stumbled upon this gem. The below happens for any radix 24 or above. parseInt(null, 24) === 23...
Gymnosophist asked 23/6, 2011 at 19:48

2

Solved

<div style="left: 100%"></div> parseInt($("div").css("left"), 10); When I try to get value of left, some browsers give result in pixels, some in %. Here is an example http://jsfiddl...
Coroneted asked 9/5, 2011 at 14:26

5

Solved

How can I convert a long integer (as a string) to a numerical format in Javascript without javascript rounding it? var ThisInt = '9223372036854775808' alert(ThisInt+'\r' +parseFloat(ThisInt).toStr...
Determined asked 18/3, 2011 at 14:27

© 2022 - 2024 — McMap. All rights reserved.