The pad operator works fine if you want to pad numbers and you could add leading or trailing zeros, even spaces however in more string based uses it fails.
Consider this in a list with the counter item and total count of items
Hi Tony! I really need to learn all this 5.3 stuff!
You don’t need to recalculate the pad size with each item. You just need to calculate the maximum size you want and add “1”. Possibly use the Count widget. So for your first example that would be “3”, and for your second example that would be “4”
But it still won’t work the way you’re hoping because HTML always crushes multiple spaces down to a single space. So possibly you could use a stub character (e.g. &) and then substitute a non-breaking space ( ) for each stub before rendering.
“Always” may be a little strong here. It doesn’t happen in <pre>-formatted text, nor when a preformatted CSS white-space property is applied. But yes, this is the norm.