Case Insensitive DateFormatSymbols for parsing
Bernd Eckenfels
ecki at zusammenkunft.net
Fri Jul 15 15:01:41 UTC 2022
Hello Roger,
Thanks for the Tipp, that’s indeed a good reason why it’s not needed in the legacy SDF API.
Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
Von: core-libs-dev <core-libs-dev-retn at openjdk.org> im Auftrag von Roger Riggs <roger.riggs at oracle.com>
Gesendet: Friday, July 15, 2022 4:14:16 PM
An: core-libs-dev at openjdk.org <core-libs-dev at openjdk.org>
Betreff: Re: Case Insensitive DateFormatSymbols for parsing
Hi Bernd,
Perhaps use java.time.format.DateTimeFormatter.
You can create a case-insensitive DateTimeFormatterBuilder using .parseCaseInsensitive().
https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/time/format/DateTimeFormatterBuilder.html#parseCaseInsensitive()
Regards, Roger
On 7/15/22 8:17 AM, Bernd Eckenfels wrote:
Hello,
I noticed that it is surprisingly hard to make SimpleDateFormat accept all-uppercase month names while parsing. Even with a custom DateFormatSymbols that’s hard because you can only specify a single symbol for a month name. For parsing it would be good if you can either specify a list of names like “June,june,JUNE” or have it allow a special case insensitive configuration option. (The list would also allow custom short forms like “ja” “fe” but not “ju”’
Am I missing something?
Gruss
Bernd
--
http://bernd.eckenfels.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20220715/e1f3f6c3/attachment-0001.htm>
More information about the core-libs-dev
mailing list