How to copy paragraphs include character styles to new document in apache poi?

I’m trying to copy a certain number of paragraphs from an ms word file into a new one with Apache Poi. Although I copy paragraph styles without problem but I can’t transfer inline character styles to …

java.util.Date is parsing wrong dates with dates before 1912

I don’t understand the reason why Jackson library is parsing wrong dates before 1912. I suppose the problem is the java.util.Date conversion, because the problem persists with Gson. This is my code: …

Do I scan twice if I call scanner.hasNext and then scanner.next

Do I scan twice if I call scanner.hasNext(pattern) and then scanner.next(pattern) with the same pattern on java.util.Scanner Let’s say i have this code with a lots of cases (trying to make a lexer): …

How to extract line with syntax error when parsing PlSQL using Antlr4

I am using the grammar file for PlSql from this Github repository. I want to underline the line in plsql file that I parse if it has a syntax error. I have the following snippet to do so: public …

How to format date/time string? (Java)

Hi can anyone help please? I am trying to format a date and time string. Currently it looks like this “20160112T110000Z” and I need it to be “2016-01-12T11:00:00Z” The string without the special …

Coding a propositional logic parser by hand

I need to do a parser for propositional logic. I pretend to do it by hand implemented like a recursive descent parser in java. My question is about the lexer, is it really needed for this job? I mean …

How parse 2013-03-13T20:59:31+0000 date string to Date

How to parse this format date string 2013-03-13T20:59:31+0000 to Date object? I’m trying on this way but it doesn’t work. DateFormat df = new SimpleDateFormat(“YYYY-MM-DDThh:mm:ssTZD”); Date result =…

How to parse a String variable into any data type in Java?

I want to build a method that can convert a String value to a given Field object data type through Java Reflection. Here is my code: String value = …; Class clazz = …

How to abbreviate HTML with Java?

A user enters text as HTML in a form, for example:

this is my blog post, very long and written in HTML

I want to …