Excel custom text format to align by first character when justified center or right


By default, a center-justified row with the Text format looks like:

enter image description here

I want the text to be center-justified in the cell and aligned by the first character, like:

enter image description here

Or

enter image description here

And if it is right-justified:

enter image description here

The solutions are fairly simple with formulas or VBA, but can these 3 formats be accomplished with custom formats? And with a variable number of characters?