# Remove characters of items

**URL:** <https://forum.dynamobim.com/t/remove-characters-of-items/5783>\
**Category:** Uncategorized\
**Created:** [August 23, 2016, 7:48am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783 "2016-08-23T07:48:27Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hoc\_Em](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@Hoc\_Em](https://forum.dynamobim.com/u/Hoc_Em)\
**Post date:** [August 23, 2016, 7:48am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/1 "2016-08-23T07:48:27Z")

</div>

Hi everyone,  
Can anyone tell me how to remove some characters of string?  
For example, I have an item “thickness default 150mm” and I’d like to remain 150 for calculation in next steps.  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [August 23, 2016, 7:58am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/2 "2016-08-23T07:58:14Z")

</div>

Hi Hoc\_Em,

What about [regular expression](https://docs.python.org/2/library/re.html)?  
 ![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/a/ae96e21725d62816c418c20c303f5634e5449c39.png)

---

<div class="post-metadata">

**Author:** ![jostein\_olsen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jostein_olsen/32/8570_2.png) [@jostein\_olsen](https://forum.dynamobim.com/u/jostein_olsen)\
**Post date:** [August 23, 2016, 8:05am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/3 "2016-08-23T08:05:48Z")

</div>

Hi,  
There are multiple ways to do this. Regular expressions, as Einar stated, may be the most robust way, but if the data is consistent you can try something like this also:  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/a/a89df120e14c156263c252f195a4df51912dccb7.png)

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [August 23, 2016, 8:18am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/4 "2016-08-23T08:18:46Z")

</div>

Here is another OOTB way, if the number alwas is last and has mm as unit

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/a/aaae23cca57aa0f844bd91b26b408b7fc005ce66.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:** [August 23, 2016, 12:02pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/5 "2016-08-23T12:02:22Z")

</div>

This might work too…  
 ![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/7/704183a987ecc5e892c660e90c7bf7bcbc61038f.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:** [August 23, 2016, 12:51pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/6 "2016-08-23T12:51:58Z")

</div>

My last response doesn’t address the original problem.  
This should (provided there is only one number in the string)…

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

Could use code to avoid the error thrown when nodes are used

```
s1=String.Split(str1,{""," "});
s2=List.Clean(String.ToNumber(s1),false);
s3=String.ToNumber(String.Join("",s2+""));
```

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [August 23, 2016, 1:32pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/7 "2016-08-23T13:32:11Z")

</div>

I overlooked the multiple separator option in Sting.Split. (Thank you Vikram, I don’t think you need it though). Here is a solution that extracts all number in the string, if you add the units to string split. Maybe a clean node would be better than RemoveIfNot.

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

---

<div class="post-metadata">

**Author:** ![Hoc\_Em](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@Hoc\_Em](https://forum.dynamobim.com/u/Hoc_Em)\
**Post date:** [August 25, 2016, 9:16am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/8 "2016-08-25T09:16:17Z")

</div>

Got it! Thank you for your help!

---

<div class="post-metadata">

**Author:** ![Tomasz\_Puchala](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@Tomasz\_Puchala](https://forum.dynamobim.com/u/Tomasz_Puchala)\
**Post date:** [August 25, 2016, 10:14am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/9 "2016-08-25T10:14:08Z")

</div>

And one more (basically it’s the same as Clockwork node)

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

---

<div class="post-metadata">

**Author:** ![Hoc\_Em](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@Hoc\_Em](https://forum.dynamobim.com/u/Hoc_Em)\
**Post date:** [August 26, 2016, 8:24am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/10 "2016-08-26T08:24:30Z")

</div>

@Tomasz_Puchala’s solution seems to be the most efficient one!

---

<div class="post-metadata">

**Author:** ![kloffredo](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kloffredo/32/48807_2.png) [@kloffredo](https://forum.dynamobim.com/u/kloffredo)\
**Post date:** [May 31, 2018, 8:41pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/11 "2018-05-31T20:41:17Z")

</div>

Hi Guys,

I am trying to shorten file name that are coming from revit. So far I am trying to find the best way to pull apart the file name, remove a few words in the string and stitch it back together. I am not sure of the best way to do this but it seems like @Tomasz_Puchala was close with his custom python node. Right now I have successfully isolated the pieces of the file name I would like to preserve but am losing the 's because I have used them as identifiers to tell dynamo where to break up the list. Can anyone help me with this?

---

<div class="post-metadata">

**Author:** ![salvatoredragotta](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/salvatoredragotta/32/10078_2.png) [@salvatoredragotta](https://forum.dynamobim.com/u/salvatoredragotta)\
**Post date:** [May 31, 2018, 11:40pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/12 "2018-05-31T23:40:59Z")

</div>

@kloffredo Please start a new topic and post what you have done so far.

---

<div class="post-metadata">

**Author:** ![nuno.pedrinho](https://avatars.discourse-cdn.com/v4/letter/n/b9bd4f/32.png) [@nuno.pedrinho](https://forum.dynamobim.com/u/nuno.pedrinho)\
**Post date:** [October 18, 2018, 11:17am UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/13 "2018-10-18T11:17:09Z")

</div>

Hi Guys,

@Tomasz_Puchala Python script works great for a list of strings. But how to make it work for a list of lists with strings? an @L3 list? or just make it work no matters the dimension of the list?

Thank you.

---

<div class="post-metadata">

**Author:** ![enrique.sg](https://avatars.discourse-cdn.com/v4/letter/e/a3d4f5/32.png) [@enrique.sg](https://forum.dynamobim.com/u/enrique.sg)\
**Post date:** [December 21, 2019, 1:08pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/14 "2019-12-21T13:08:27Z")

</div>

Hello all,

How do I delete the value " and extract the float number?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b97e52287a34ef8bd53cdf6ac2ffac84e273aaa.png)

---

<div class="post-metadata">

**Author:** ![enrique.sg](https://avatars.discourse-cdn.com/v4/letter/e/a3d4f5/32.png) [@enrique.sg](https://forum.dynamobim.com/u/enrique.sg)\
**Post date:** [December 21, 2019, 1:10pm UTC](https://forum.dynamobim.com/t/remove-characters-of-items/5783/15 "2019-12-21T13:10:20Z")

</div>

I am trying to extract the float number i.e: 16.2 from first value on the list below:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/7/a72bfc20707a190f15e44f6988383aca5fb8eb3e.png)
