Skip to content

Tag: parsing

How to parse TOML document with Java

In my Java app I get a TOML document from REST service response as String and I look how to parse it and convert to Java objects. Ideally I’d like to use some existing mapper library for deserialization, something like Jackson or Gson for JSON objects. Are there any options in Java ecosystem for that? A…

How to use DateTimeFormatter for pattern dMMyyyy

I need to parse Strings to LocalDate using DateTimeFormatter. There are 2 different cases, Strings of pattern dMMyy or ddMMyy (20320, 020320, 120320) and Strings of pattern ddMMyyyy or dMMyyyy (2032020, 02032020, 12032020). For the first case i can just use DateTimeFormatter.ofPattern(“dMMyy”) whi…

Protocol error trying to parse XML response in Java

I am successfully making an API call that is a SOAP request with an account number in the body. I connected using Httpurlconnection and I am reading those results using BufferedReader: Then using documentbuilderfactory to build the doc to read into the parser: And then try to parse: NodeList returnList = xmlD…

Char variable minus char variable parse to Int in java

I know this is trivial, but I can’t find the proper explication. I have the following code How does this parsing work? Answer As long as the character is a digit, you can get the equivalent int value by subtracting ‘0’. The ASCII coding for ‘0’ is decimal 48, ‘1’ is d…