# String.replace within sublists

**URL:** <https://forum.dynamobim.com/t/string-replace-within-sublists/3855>\
**Category:** Packages\
**Created:** [April 28, 2016, 5:50am UTC](https://forum.dynamobim.com/t/string-replace-within-sublists/3855 "2016-04-28T05:50:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene\_Fuhren](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/rene_fuhren/32/8828_2.png) [@Rene\_Fuhren](https://forum.dynamobim.com/u/Rene_Fuhren)\
**Post date:** [April 28, 2016, 5:50am UTC](https://forum.dynamobim.com/t/string-replace-within-sublists/3855/1 "2016-04-28T05:50:23Z")

</div>

Hello everyone,

Another day, another Dynamo challenge 🙂

I am working on automating my wall legend creation. What I have managed to do is read the wall’s compound structure layers’ materials. Now, as the naming convention used by the architect is not exactly our firm’s naming convention I want to string.replace my way out of it! 🙂 As well, I read the material’s thickness and try to ‘string.insert’ this information at the end of the materials’ strings. I hope my intention is clear!

Now, for one wall type at a time this is working flawlessly. However, I do not want to repeat this for each wall type (30+) and so I am trying to work with lists while replacing these strings, so I only have to hit ‘run’ once for my entire legend. Please see the attachment. In this example I have 4 wall types [0] through [3] with their respective materials. In this case I am trying to replace the string ‘CW-profielen’ (left) for every list item with its respective replacements (on the right). Although in this case they all say ‘600mm’, obviously this number can vary per wall type.

How can I manage to replace the ‘CW-profielen’-string of list item [0] with the ‘CW-profielen, h.o.h.: 600mm’ of item [0], [1] with [1], [2] with [2] and [3] with [3]?

I have been trying all morning, it should not be so hard! I am thinking something like list.map .combine .cycle? I am looking forward to your suggestions!

 ![Knipsel](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/1/1b6b0ba4be7e5e67865108b343b62437c4b69195.png)

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [April 28, 2016, 7:15am UTC](https://forum.dynamobim.com/t/string-replace-within-sublists/3855/2 "2016-04-28T07:15:38Z")

</div>

Hi René, I think this should work for you (just replace “c” by the string you want to replace) :

 ![rep string](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/1/13cc8177eac215b850ead2896ee176e43111ef6c.png)

---

<div class="post-metadata">

**Author:** ![Organon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/organon/32/161404_2.png) [@Organon](https://forum.dynamobim.com/u/Organon)\
**Post date:** [April 28, 2016, 7:55am UTC](https://forum.dynamobim.com/t/string-replace-within-sublists/3855/3 "2016-04-28T07:55:09Z")

</div>

![String.Replace](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/e/e615ebcb37a339301dbf4f9b4974353b8f838454.png)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [April 28, 2016, 11:19am UTC](https://forum.dynamobim.com/t/string-replace-within-sublists/3855/4 "2016-04-28T11:19:24Z")

</div>

Straight forward on the latest build

 ![20160428-2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/0/04d7dfc9f14b3f2a714535d9ba301c727c0c0127.png)
