How to split a string containing date and words?

99
July 03, 2022, at 01:50 AM

I have a bunch of string in the format "02-01-2014 10:02:01:001 abcd efgh" If I want to split it as ["02-01-2014 10:02:01:001", "abcd efgh"], how do I do that?

Currently, I'm splitting based on the knowledge that the first 23 characters contain the date so I'm just taking a substring till there. Is there any better way?

Answer 1

Something like:

Patter.compile("\\d{2}-\\d{2}-\\d{4}\\s\\d{2}:\\d{2}:\\d{2}:\\d{3}\\s(.*)");

Then use matcher capturing group 1.

Rent Charter Buses Company
READ ALSO
DataDog trace JMS

DataDog trace JMS

I'am using the "dd-trace-ot" version 093

104
Auto generate hal links for in spring boot

Auto generate hal links for in spring boot

Is it possible to have Spring Boot automatically generate hal links for rest controller just like it does for repository?

123
How to read ArrayList<String> field from database with PostgreSQL JDBC

How to read ArrayList<String> field from database with PostgreSQL JDBC

I'm having an issue with getting the value of stored ArrayList<String> as VARCHAR[] in the database

112