NumberFormat: parse () vs parseObject ()

When would it be possible to use parseObject() rather than parse() ? I know that the first returns Object and the second returns Number, however, when an object other than a Number parseObject() , what justifies the existence of parseObject() ?

+4
source share
1 answer

If you know that you are dealing with NumberFormat , there is probably no good reason. However, if you are in an unusual situation, knowing only about Format , then you do not know what value you use parsing and parseObject is all there is.

Personally, I don’t remember ever using only the usual Format myself, but I believe that if you are in the general business of parsing and formatting (for example, for a user interface widget), then this can be useful.

+3
source

Source: https://habr.com/ru/post/1501941/


All Articles