How to align two elements with one of them having variable length?

Hi, community! I have a text which is users name. What I want to do is to place a star rating on the right side of the text. My problem is that the length of the text is a variable. How do I set the star rating so it would be placed straight after the text ends? Thank you.