# Spaces and Dashs

**URL:** <https://community.mp3tag.de/t/spaces-and-dashs/53152>\
**Category:** Support\
**Created:** [May 8, 2021, 9:53pm UTC](https://community.mp3tag.de/t/spaces-and-dashs/53152 "2021-05-08T21:53:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ted.D-Bear](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@Ted.D-Bear](https://community.mp3tag.de/u/Ted.D-Bear)\
**Post date:** [May 8, 2021, 9:53pm UTC](https://community.mp3tag.de/t/spaces-and-dashs/53152/1 "2021-05-08T21:53:07Z")

</div>

I'm struggling to find the information in this forum. I'm not coming up with what I need, or what I'm finding is not working when I try it.

In my "Title" and "Artist" fields, I have some entries which have one, or maybe two leading spaced before the information. How do I get rid of the spaces before the Title and Artist?

In the Filename, I have a similar problem with spaces at the end of the file. So a file such as TITLE - ARTIST.mp3 will actually be TITLE - ARTIST .mp3. How do I get rid of the space(s) before the .mp3 which are not necessary.

Finally, my Filename is suppose to be %Title" - %Artist%.mp3 but I have some files with the dash up against the Artist, sometimes the Title, and several will have two spaces between the dash and the Artist or Title. Is there any way to clean this up?

Frederick

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [May 9, 2021, 5:25am UTC](https://community.mp3tag.de/t/spaces-and-dashs/53152/2 "2021-05-09T05:25:38Z")

</div>

Use the scripting function $trim() which will delete space before and after a the content of a tagfield.  
I would not treat the filename directly but build a new filename with the corrected tagfields.

So define an action group with 3 actions:

1. Action:  
Type: Format Value  
Field: ARTIST  
Format String: $trim(%artist%)

2. Action:  
Type: Format Value  
Field: ARTIST  
Format String: $trim(%title%)

3. Action:  
Type: Format Value  
Field: \_FILENAME  
Format String: %title% - %artist%

[https://docs.mp3tag.de/actions/format](https://docs.mp3tag.de/actions/format)

In spite of the actions you could also use the different converters one after another which have a preview of the result of the format strings.

---

<div class="post-metadata">

**Author:** ![Ted.D-Bear](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/7993a0/32.png) [@Ted.D-Bear](https://community.mp3tag.de/u/Ted.D-Bear)\
**Post date:** [May 9, 2021, 6:03pm UTC](https://community.mp3tag.de/t/spaces-and-dashs/53152/3 "2021-05-09T18:03:19Z")

</div>

> [@poster](#):
>
> $trim(%artist%)

THANK YOU. That works perfectly, and cleaned up the databases.

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:29pm UTC](https://community.mp3tag.de/t/spaces-and-dashs/53152/4 "2026-02-09T12:29:13Z")

</div>


