# Limit ID tag if Char is "greater than"

**URL:** https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077
**Category:** Support
**Created:** [June 29, 2016, 5:17pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077 "2016-06-29T17:17:32Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)
#### Post date: [June 29, 2016, 5:17pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/1 "2016-06-29T17:17:32Z")

</div>

I have a Clarion AutoPC that plays MP3s and it has a limited non scrolling title show feature from the ID tags. I want to limit the chars in the artist and title fields for my unique MP3 that I use in that system.

So I am using this:

```
Format Value: Title
Value: $left(%title%,18)..

```

As you an see it cuts the title at 18 chars from the left, but it also adds the ".." I want to show truncation on the display, but I am looking to add some intelligence so that the ..'s are not added unless the file was actually truncated.

Some files don't need the truncation, so I'm looking to crop at 18 and add .. for 20 chars total without a space after the last char.

Anyone have a thought on how to best achieve this as an Action?

Best,  
Chris

---

<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: [June 29, 2016, 5:41pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/2 "2016-06-29T17:41:33Z")

</div>

Perhaps you find inspiration in this thread:

[/t/16455/1](https://community.mp3tag.de/t/16455/1)

e.g.  
$ifgreater($len(%title%),18,$left(%title%,18)..,%title%)

---

<div class="post-metadata">

### Author: ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)
#### Post date: [June 29, 2016, 6:09pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/3 "2016-06-29T18:09:22Z")

</div>

Following your idea, I came up with:

```
$iflonger(%title%, 18, $left(%title%,18)..,%title% )

```

The only issue I'm seeing now is that I'm getting a leading white space at the beginning of the char and white space at the end.

Not sure why it's adding the white space. What am I doing wrong?

TY

 ![](https://community.mp3tag.de/uploads/default/original/2X/d/df41a21051d0d6644bc541c8c27ab63ca70282e8.png)  

 ![](https://community.mp3tag.de/uploads/default/original/2X/d/d41d81ca8dd036314fe8b723061a0648833345e1.png)

---

<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: [June 29, 2016, 6:13pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/4 "2016-06-29T18:13:57Z")

</div>

> [@kittmaster](#):
>
> ...
> 
> ```
> $iflonger(%title%, 18, $left(%title%,18)..,%title% )
> 
> ```
> 
> ...white space ...

The blank in front of the $left() is taken as an literal character.  
The blank in front of the ) after %title% is taken as a literal character.

See what the expression in post #2 does for you.

---

<div class="post-metadata">

### Author: ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)
#### Post date: [June 29, 2016, 6:28pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/5 "2016-06-29T18:28:36Z")

</div>

TY!

Ok, so now when I remove the literal spaces the ".." are having a single white space added between the cropped title just before the appended ..

So instead of:

"PINK COOKIES IN A.."

I'm getting:

"PINK COOKIES IN A .."

---

<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: [June 29, 2016, 6:32pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/6 "2016-06-29T18:32:14Z")

</div>

> [@kittmaster](#):
>
> ...are having a single white space added between the cropped title just before the appended ..  
> ...

Please show us the exact expression that you use.  
(Or: did you try the expression in post #2?)

---

<div class="post-metadata">

### Author: ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)
#### Post date: [June 29, 2016, 7:06pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/7 "2016-06-29T19:06:14Z")

</div>

I copied and pasted the string you posted in #2

```
$ifgreater($len(%title%),18,$left(%title%,18)..,%title%)
```

---

<div class="post-metadata">

### Author: ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)
#### Post date: [June 29, 2016, 9:43pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/8 "2016-06-29T21:43:42Z")

</div>

I found it's not an issue with the script, the last space is actually the 18th character. I'll look to see if the $trimRight can help fix this issue.

---

<div class="post-metadata">

### Author: ![kittmaster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/kittmaster/32/14793_2.png) [@kittmaster](https://community.mp3tag.de/u/kittmaster)
#### Post date: [June 30, 2016, 12:12am UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/9 "2016-06-30T00:12:08Z")

</div>

Here is my final fix that what works for my needs.

```
$ifgreater($len(%title%),18,$trimRight($left(%title%,18))..,%title%)
$ifgreater($len(%artist%),10,$trimRight($left(%artist%,10))..,%artist%)

```

Thanks for all your help.

---

<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:26pm UTC](https://community.mp3tag.de/t/limit-id-tag-if-char-is-greater-than/18077/10 "2026-02-09T12:26:19Z")

</div>


