Receipt

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 619 Views - Last Post: 28 November 2019 - 12:11 AM Rate Topic: -----

#16 Luthariel   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-November 19

Re: Receipt

Posted 28 November 2019 - 12:11 AM

View PostNormR, on 27 November 2019 - 04:33 PM, said:

Quote

typecasting the String input into an Int again

A String can not be cast to an int (not Int). A String's contents can be extracted to an int by using an Integer class's method.


As you may have seen in the first line, I meant to write int not Int. Having a german PC it sometimes changes things to uppercase whenever it thinks there is a noun to follow.
While most are aware of it, you are the first one to actually point it out that way. But whatever floats your boat.

And regarding the Casting, I am sorry for confusing you. With 'typecasting' I wanted to summarize all possibilities there are. And that's not only the Integer class's method "Integer.parseInt()", "Integer.valueOf()" or ".toInteger", but also "Optional.ofNullable(myString).map(Ints::tryParse)" from the Guava Library, as well as other ways. :-)

Good morning and have a nice day.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2