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.
I really don't like counting things and halving them and adding things to make sure things turn out right and then hoping I can explain why I added 1 or 2 to the right place.
Anyway, I got there in the end and it was maybe more fun than I'm letting on: https://gist.github.com/philnash/26dd64fc9896b982392818089e0619f4