Sometimes, when I'm programming, I haven't got a good idea of how to do something. What I do have is a large collection of really bad ideas, that I use when I don't have a good idea.
Apparently, good ideas take time. And sometimes they only happen after trying out some really horrendous ideas.
So, I checked the follwing String expression in Kotlin in, and I got some code review comments on it.
The comment was: "put a trim() on the entire thing, as the additionalDescription, which is provided by the user, can be anything (like for example spaces or just empty)".
And I got stuck on that. I came up with something horrendous like the following:
Of course you can immediately see where I went wrong, but once you get invested in the String template solution, sometimes it's hard to break out of that solution again.
The solution I went for was (obviously):