The challenge here is to turn this JSON object:
{
"columns": 80,
"padChar": "·",
"events": [
{ "name": "CODE100", "location": "Zagreb, Croatia", "date": "29.11.2023" },
{ "name": "LIVE", "date": "ongoing" },
{ "name": "Coffee With Developers", "location": "various", "date": "ongoing"} ,
{ "name": "World Congress","location": "Berlin, Germany", "date":"17-19.07.2024" }
]
}
Into a block like this:
································································
· CODE100 ············ Zagreb, Croatia ··········· 29.11.2023 ·
· LIVE ··············································· ongoing ·
· Coffee With Developers ·· various ·················· ongoing ·
· World Congress ······ Berlin, Germany ········ 17-19.07.2024 ·
································································
The rules are that the location needs to be centered in the 80 columns wide block, the name on the left and the date on the right. Each need to have spaces surrounding them. (and no, this demo isn’t the right amount of chars).
Happy coding!
Explain or link to your solutions in the comment section here.
Some initial thoughts on this while having breakfast...might not fit all edge cases.....is the whole data set available?
.https://gist.github.com/dk5ax/ca1d80b011a029f361cba3667682d9e8