If you want to make sure a text is of given length, here is an easy approach:
$text = 'this is a long text' $MaxLength = 10 $text.PadRight($MaxLength).Substring(0,$MaxLength)
This code first pads the text in case it is shorter than the maximum length, and then Substring() is cutting off excess text.