# How to remove whitespace right to a string based on its length?

**URL:** https://community.mp3tag.de/t/how-to-remove-whitespace-right-to-a-string-based-on-its-length/67234
**Category:** Export
**Created:** [January 22, 2025, 1:44am UTC](https://community.mp3tag.de/t/how-to-remove-whitespace-right-to-a-string-based-on-its-length/67234 "2025-01-22T01:44:48Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 22, 2025, 7:27am UTC](https://community.mp3tag.de/t/how-to-remove-whitespace-right-to-a-string-based-on-its-length/67234/2 "2025-01-22T07:27:50Z")

</div>

> [@tor11](#):
>
> Can someone help with this function?

I don't see a function.

The real, current code would help a lot.

Basically, you determine the length of the whole real string and then $repeat() a number of space characters in which you take the total position of the `|` and $sub() the length.

Here is a (German) thread that centers text:

> [@Frage zur Exportfunktion: %Album% mittig ausgeben](https://community.mp3tag.de/t/frage-zur-exportfunktion-album-mittig-ausgeben/15308):
>
> Hallo ich hab noch einmal eine Frage zur Exportfunktion ich möchte den Namen eines Albums (%album%) automatisch mittig in einem Überschrift-Rahmen plazieren. Die Rahmenbreite ist fest vorgegebne (z.B. 65 Zeichen) etwa so: ================================================================================ =..................................mein Album..................................= ================================================================================ (die Punkte links und rech…

The code should be readable, though

---

_[View the full topic](https://community.mp3tag.de/t/how-to-remove-whitespace-right-to-a-string-based-on-its-length/67234)._
