Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #826
| From | Lothar Kimmeringer <news200709@kimmeringer.de> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? |
| Date | 2011-07-06 11:22 +0200 |
| Organization | Organization?! Only chaos here! |
| Message-ID | <10ygcvt3gwxo3.dlg@kimmeringer.de> (permalink) |
| References | (1 earlier) <iulrmk$sg9$1@dont-email.me> <k4b6175jsqa1kie5u7b7pjed29td61lkf1@4ax.com> <iuvi8e$m6g$1@dont-email.me> <7an6179km7upsvba40ebe98gmfedg2414k@4ax.com> <iuvs5c$tbm$1@dont-email.me> |
Eric Sosman wrote:
> On 7/5/2011 2:57 PM, Thee Chicago Wolf [MVP] wrote:
>> The limit is because you can't
>> convert a string of numbers to int past 9 digits or it bombs out.
>
> ... and it depends on which nine digits, too: "111111111" is
> just fine as an `int', while "555555555" is not.
Objection, your honor ;-)
> I imagine that
> your homework exercise is intended to bring you to an understanding
> of this limitation, and also intended to introduce you to other
> ways of representing integers than as `int' values.
In that case I wouldn't use 1000-digit numbers but numbers with
10 digits, where some of them are below 2^31 and some are higher
to let the parseInt-method fail.
> Two methods, surely. And I hope by now you understand that
> integer-to-string is a far simpler matter than string-to-integer.
toString() is simple indeed but in real life scenarios you
often need to format it in a human readable way, so I18N
comes into place, complicating things.
Regards, Lothar
--
Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)
Always remember: The answer is forty-two, there can only be wrong
questions!
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-01 12:53 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Jeff Higgins <jeff@invalid.invalid> - 2011-07-01 17:55 -0400
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-01 18:19 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 10:26 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-05 13:39 -0400
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 13:57 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-05 13:01 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 15:47 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-05 14:57 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 13:11 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-06 11:54 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 16:58 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-06 15:36 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Patricia Shanahan <pats@acm.org> - 2011-07-06 16:53 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? markspace <-@.> - 2011-07-06 18:07 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-07-06 09:57 +0100
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 13:13 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-07-07 09:43 +0100
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-07-06 11:15 +0200
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-06 13:14 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-05 16:27 -0400
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Lothar Kimmeringer <news200709@kimmeringer.de> - 2011-07-06 11:22 +0200
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-06 07:33 -0400
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-01 23:06 -0400
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Patricia Shanahan <pats@acm.org> - 2011-07-01 20:28 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 10:27 -0500
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? Roedy Green <see_website@mindprod.com.invalid> - 2011-07-04 08:59 -0700
Re: Convert a String to Int: can I use toInt() instead of Integer.parseInt()? "Thee Chicago Wolf [MVP]" <.@.> - 2011-07-05 10:30 -0500
csiph-web