parseint Questions

10

Solved

I just want to know if there's a better solution to parse a number from a character in a string (assuming that we know that the character at index n is a number). String element = "el5"; String s;...
Dagoba asked 11/2, 2011 at 11:11

7

Solved

I have just observed that the parseInt function doesn't take care about the decimals in case of integers (numbers containing the e character). Let's take an example: -3.67394039744206e-15 > pa...
Reisinger asked 11/5, 2015 at 6:30

2

Solved

I've read an article about JavaScript parseInt, which had this question: parseInt(0.5); // => 0 parseInt(0.05); // => 0 parseInt(0.005); // => 0 parseInt(0.0005); // => 0 parseInt(0.000...
Indulgence asked 18/10, 2021 at 9:18

2

Solved

What's the function to create a int value from string i := ???.????( "10" )
Magical asked 20/4, 2010 at 6:14

3

Solved

I'm reading this but I'm confused by what is written in the parseInt with a radix argument chapter Why is it that parseInt(8, 3) → NaN and parseInt(16, 3) → 1? AFAIK 8 and 16 are not base-3 num...
Pestilent asked 25/8, 2016 at 13:47

1

Solved

Would the runtime of Integer.parseInt(String i) and Integer.toString(int i) both be O(n)?
Prodigious asked 13/5, 2020 at 18:53

4

Solved

Is there a straightforward way to parse a string to either integer or float if I don't know if the variable is integer-number-like or decimal-number-like? a = '2'; // => parse to integer b = '2...
Gershom asked 5/11, 2015 at 12:41

2

Solved

System.out.println(Integer.parseInt("7FFFFFFF", 16)); //this is ok. System.out.println(Integer.parseInt("FFFFFFFF", 16)); //this throws Exception System.out.println(Integer.valueOf("FFFFFFFF", 16))...
Idellaidelle asked 24/3, 2020 at 10:17

4

long story short, i was trying to validate a phone field. ive added the isNaN and parseInt for checking the " " in the field but that said This below never validates to true..what am i missing? i...
Extreme asked 17/4, 2012 at 2:40

6

Solved

So, In Java, you know how you can declare integers like this: int hex = 0x00ff00; I thought that you should be able to reverse that process. I have this code: Integer.valueOf(primary.getFullHex...
Pettifogger asked 7/7, 2012 at 19:17

11

Solved

How is parseInt() different from valueOf() ? They appear to do exactly the same thing to me (also goes for parseFloat(), parseDouble(), parseLong() etc, how are they different from Long.valueOf(s...
Avina asked 3/2, 2009 at 19:56

4

Solved

I am working on a basic calculator that takes input like this " 100 + 10/2 + 3 + 0 " and returns the output in a separate field. when I break this thing into an array zero is not parsed as integer...
Phonologist asked 21/7, 2018 at 17:48

8

Solved

I'm wondering how to do something only if Integer.parseInt(whatever) doesn't fail. More specifically I have a jTextArea of user specified values seperated by line breaks. I want to check each lin...
Comedienne asked 23/6, 2011 at 15:3

8

Solved

parseFloat("NaN") returns "NaN", but parseFloat("NaN") == "NaN" returns false. Now, that's probably a good thing that it does return false, but I don't understand how this is so. Did the JavaS...
Baptlsta asked 8/8, 2011 at 0:15

8

Solved

I need to parse a string user id into integer for that I used Integer.parseInt(String s) but it returns null/nil, if there string has/holds non-decimal/integer value and in that case, I need ...
Spaceman asked 3/8, 2017 at 10:27

3

Solved

I've always used the parseInt() function in Javascript without passing the radix parameter. As per the MDN documentation here, it's stated that not providing this parameter may result in unpredicta...
Procryptic asked 7/7, 2017 at 12:53

4

Solved

I have an example of data that has spaces between the numbers, however I want to return the whole number without the spaces: mynumber = parseInt("120 000", 10); console.log(mynumber); // 120 i w...
Marcela asked 18/1, 2017 at 21:20

7

Solved

When I run parseInt: Integer.parseInt(myString); it throws: NumberFormatException: For input string: "" Does this mean I have do something like this? if(StringUtils.isNotBlank(myString)) re...
Galba asked 8/1, 2012 at 20:24

4

Solved

I'm trying to import text from a text file which has been generated in another Activity. The generated text file is made up of a String ArrayList which only contains numbers and the other random te...
Mendie asked 3/9, 2011 at 9:2

3

Solved

As a case study, I am trying to get to grips with this code snippet that uses the parseInt() function, and have a couple questions: var maxChars = parseInt( formField.attr('maxlength') ? formField....
Inappreciative asked 1/5, 2012 at 14:5

3

Solved

I am trying to do something relatively simple. I have a date in this format dd/MM/yyyy eg: var newDate = "‎11‎/‎06‎/‎2015"; And I want to convert it to a date. This code only works in Chrome an...
Piece asked 11/6, 2015 at 14:39

2

Solved

This question is similar to this other question; however, I'd like to understand why this is working as it is. The following code: console.log((parseInt('0xdeadbeef', 16) & parseInt('0x000000...
Recalcitrate asked 14/2, 2015 at 20:0

2

I've try to probe that plus (+) conversion is faster than parseInt with the following jsperf, and the results surprised me: Parse vs Plus Preparation code <script> Benchmark.prototype.set...
Wildermuth asked 11/2, 2015 at 15:4

3

Solved

Java's ParseInt method will happily parse decimal values supplied with a leading zero without throwing an exception, stripping the zero: int value = Integer.parseInt("050", 10); will result in t...
Chaplin asked 5/2, 2015 at 13:6

6

Solved

I'm importing some JSON files into my Parse.com project, and I keep getting the error "invalid key:value pair". It states that there is an unexpected "8". Here's an example of my JSON: } "Manuf...
Microsecond asked 8/12, 2014 at 15:45

© 2022 - 2024 — McMap. All rights reserved.