# Where to put in $replace

**URL:** https://community.mp3tag.de/t/where-to-put-in-replace/19070
**Category:** General Discussion
**Created:** [June 22, 2017, 1:35pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070 "2017-06-22T13:35:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![MusicBits](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MusicBits](https://community.mp3tag.de/u/MusicBits)
#### Post date: [June 22, 2017, 1:35pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070/1 "2017-06-22T13:35:49Z")

</div>

Hi all

Jeg har copied this code from another .nfo:  
$loop($num(%discnumber%,3)$num(%track%,4)%\_filename\_ext%)$num(%track%,2). %title%$repeat( ,$sub(57,$len(%title%))) [$replace(%_length%,_,:)]  
$loopend()

I need to put this in  
$replace(%title%,Å,Aa,å,aa,Æ,Ae,æ,ae,Ø,Oe,ø,oe,)

I can get it to work with:  
$loop($num(%discnumber%,3)$num(%track%,4)%\_filename\_ext%)$num(%track%,2). $replace(%title%$repeat( ,$sub(57,$len(%title%))),Å,Aa,å,aa,Æ,Ae,æ,ae,Ø,Oe,ø,oe,) [$replace(%_length%,_,:)]  
$loopend()

But then I mess up the aligenment with the %lenght% is moves the extra char if say Ø is replaced with OE.

How to I get about this? Thank you.

---

<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 22, 2017, 3:47pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070/2 "2017-06-22T15:47:35Z")

</div>

> [@MusicBits](#):
>
> ...  
> How to I **get** about this? Thank you.

Yes, exactly: use $put and $get to save the result of the $replace() function and recycle it where you need it:

$loop($num(%discnumber%,3)$num(%track%,4)%\_filename\_ext%)$puts(aa,$replace(%title%,Å,Aa,å,aa,Æ,Ae,æ,ae,Ø,Oe,ø,oe,)) $num(%track%,2). $get(aa)$repeat( ,$sub(57,$len($get(aa)))) [$replace(%_length%,_,🙂]  
$loopend()

---

<div class="post-metadata">

### Author: ![MusicBits](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MusicBits](https://community.mp3tag.de/u/MusicBits)
#### Post date: [June 22, 2017, 4:24pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070/3 "2017-06-22T16:24:45Z")

</div>

> [@ohrenkino](#):
>
> Yes, exactly: use $put and $get to save the result of the $replace() function and recycle it where you need it:
> 
> $loop($num(%discnumber%,3)$num(%track%,4)%\_filename\_ext%)$puts(aa,$replace(%title%,Å,Aa,å,aa,Æ,Ae,æ,ae,Ø,Oe,ø,oe,)) $num(%track%,2). $get(aa)$repeat( ,$sub(57,$len($get(aa)))) [$replace(%_length%,_,🙂]  
> $loopend()

Thank you very much! 🙂

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 22, 2017, 5:00pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070/4 "2017-06-22T17:00:02Z")

</div>

> [@MusicBits](#):
>
> ... copied this code from another .nfo:  
> $loop($num(%discnumber%,3)$num(%track%,4)%\_filename\_ext%)$num(%track%,2). %title%$repeat( ,$sub(57,$len(%title%))) [$replace(%_length%,_,🙂]$loopend()  
> I need to put this in $replace(%title%,Å,Aa,å,aa,Æ,Ae,æ,ae,Ø,Oe,ø,oe,)  
> ... I mess up the aligenment with the %lenght% ... How to I get about this? Thank you.

Here is an export script proposal to modify it to your needs, if ever, ...

```
$filename($getEnv('USERPROFILE')'\desktop\MusicBits.txt',UTF-8)
$loop($num(%discnumber%,3)$num(%track%,2)%_path%)$num(%track%,2)'. '$left($replace(%title%,'Å','Aa','å','aa','Æ','Ae','æ','ae','Ø','Oe','ø','oe')$repeat($char(32),57),57)' : '[$replace(%_length%,'_',':')]
$loopend()

```

DD.20170622.2100.CEST

---

<div class="post-metadata">

### Author: ![MusicBits](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MusicBits](https://community.mp3tag.de/u/MusicBits)
#### Post date: [June 22, 2017, 7:54pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070/5 "2017-06-22T19:54:52Z")

</div>

> [@ohrenkino](#):
>
> Yes, exactly: use $put and $get to save the result of the $replace() function and recycle it where you need it:
> 
> $loop($num(%discnumber%,3)$num(%track%,4)%\_filename\_ext%)$puts(aa,$replace(%title%,Å,Aa,å,aa,Æ,Ae,æ,ae,Ø,Oe,ø,oe,)) $num(%track%,2). $get(aa)$repeat( ,$sub(57,$len($get(aa)))) [$replace(%_length%,_,🙂]  
> $loopend()

Abit problems. Now the brackets don't show - quote ' is replaced with Å.

I cant find the error.

---

<div class="post-metadata">

### Author: ![MusicBits](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/aeb1de/32.png) [@MusicBits](https://community.mp3tag.de/u/MusicBits)
#### Post date: [June 22, 2017, 7:57pm UTC](https://community.mp3tag.de/t/where-to-put-in-replace/19070/6 "2017-06-22T19:57:59Z")

</div>

QUOTE (DetlevD @ Jun 22 2017, 21:00) \<{POST\_SNAPBACK}\>

Here is an export script proposal to modify it to your needs, if ever, ...

```
$filename($getEnv('USERPROFILE')'\desktop\MusicBits.txt',UTF-8)
$loop($num(%discnumber%,3)$num(%track%,2)%_path%)$num(%track%,2)'. '$left($replace(%title%,'Å','Aa','å','aa','Æ','Ae','æ','ae','Ø','Oe','ø','oe')$repeat($char(32),57),57)' : '[$replace(%_length%,'_',':')]
$loopend()

```

DD.20170622.2100.CEST

Nice, thank you. 🙂
