# Remove extra Digits

**URL:** <https://forum.dynamobim.com/t/remove-extra-digits/83298>\
**Category:** Uncategorized\
**Created:** [November 20, 2022, 6:55pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298 "2022-11-20T18:55:18Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![stolz-andreas](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@stolz-andreas](https://forum.dynamobim.com/u/stolz-andreas)\
**Post date:** [November 20, 2022, 6:55pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/1 "2022-11-20T18:55:18Z")

</div>

By converting it into a string, Dynamo adds me some extra digits.

Can I remove them in Dynamo or in Revit?

 ![Screenshot 2022-11-20 195002](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/a/2af197f3ebc4cb7d19660f3c24c661cfaa0c5acc.png)

---

<div class="post-metadata">

**Author:** ![jw.vanasselt](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jw.vanasselt/32/133533_2.png) [@jw.vanasselt](https://forum.dynamobim.com/u/jw.vanasselt)\
**Post date:** [November 20, 2022, 7:54pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/2 "2022-11-20T19:54:29Z")

</div>

You can use the split node to split the string by , for example. Or you can use the string remove node

---

<div class="post-metadata">

**Author:** ![stolz-andreas](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@stolz-andreas](https://forum.dynamobim.com/u/stolz-andreas)\
**Post date:** [November 20, 2022, 8:08pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/3 "2022-11-20T20:08:29Z")

</div>

How does that look like?

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [November 20, 2022, 8:26pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/4 "2022-11-20T20:26:12Z")

</div>

Hello  
2 methods (Package Crumple + remove )

 ![20 Novembre forum anglaisrep 5_2022-11-20_09-23-30](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/0/80e841ac7de2bc221d16ebc5c5d10d2a66f70ba5.png)

cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![Daniel\_Hurtubise](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daniel_hurtubise/32/146534_2.png) [@Daniel\_Hurtubise](https://forum.dynamobim.com/u/Daniel_Hurtubise)\
**Post date:** [November 20, 2022, 8:53pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/5 "2022-11-20T20:53:50Z")

</div>

There’s a node in the Data-Shapes package names “Number to Rounded String”

---

<div class="post-metadata">

**Author:** ![stolz-andreas](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@stolz-andreas](https://forum.dynamobim.com/u/stolz-andreas)\
**Post date:** [November 20, 2022, 10:16pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/6 "2022-11-20T22:16:50Z")

</div>

Where is the Solution without Digits?

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [November 20, 2022, 10:34pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/7 "2022-11-20T22:34:25Z")

</div>

0 for incoming for Crumple String.rounding node at digits level

and 6 instead of 4 in the code block for the remove solution

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [November 20, 2022, 11:57pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/8 "2022-11-20T23:57:41Z")

</div>

The simplistic Python 🐍 explanation.

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

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [November 21, 2022, 8:57am UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/9 "2022-11-21T08:57:54Z")

</div>

Or like this 🙂

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

---

<div class="post-metadata">

**Author:** ![viktor\_kuzev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/viktor_kuzev/32/48254_2.png) [@viktor\_kuzev](https://forum.dynamobim.com/u/viktor_kuzev)\
**Post date:** [November 21, 2022, 9:47am UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/10 "2022-11-21T09:47:28Z")

</div>

You can use the Number.ToString node from Springs or do it in a Python node in different ways(I prefer the one below):

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/9/c9d2cab7b7bdbc1b388f2019e13c7b25e0ca7542.png)

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [November 21, 2022, 9:48am UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/11 "2022-11-21T09:48:03Z")

</div>

Use some magic with regex, if `1,23545` is input or `1,323443dadwa` 🙂

```auto
input = IN[0]
import re
OUT = re.sub(r',.*', '', input)

```

With input is `1.3565` or `1.4343dadawdwa`

```auto
input = IN[0]
import re
re.sub(r'\..*', '', input)

```

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 21, 2022, 7:50pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/12 "2022-11-21T19:50:14Z")

</div>

For information, [rstrip](https://docs.python.org/3/library/stdtypes.html) method can accept multiple characters as argument

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/0/9039cdb46616bff1768d6d7bf706ce22a48bf129.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 21, 2022, 8:12pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/13 "2022-11-21T20:12:08Z")

</div>

You can also fix this by just converting the number to an integer. `Math.Floor` (or `Ceiling`) will work. This happens when the number is a double and the string includes the trailing zeroes.

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [November 21, 2022, 8:40pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/14 "2022-11-21T20:40:13Z")

</div>

😍 Love the options everyone 👍

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [November 21, 2022, 8:51pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/15 "2022-11-21T20:51:57Z")

</div>

Hello  
base on your idea

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/b/fb36803ad653f9d3723192ac9a47d9792f9d04ce.png)  
cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![viktor\_kuzev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/viktor_kuzev/32/48254_2.png) [@viktor\_kuzev](https://forum.dynamobim.com/u/viktor_kuzev)\
**Post date:** [November 25, 2022, 2:47pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/16 "2022-11-25T14:47:34Z")

</div>

I didn’t know that, but it would still make a 20.000 into a 2, wouldn’t it?

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [November 25, 2022, 2:51pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/17 "2022-11-25T14:51:54Z")

</div>

Correct, thats why i would just use python’s round() function and turn that into a string.

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [November 25, 2022, 7:12pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/18 "2022-11-25T19:12:43Z")

</div>

good catch, I didn’t consider this case, so it doesn’t work

---

<div class="post-metadata">

**Author:** ![stolz-andreas](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@stolz-andreas](https://forum.dynamobim.com/u/stolz-andreas)\
**Post date:** [December 4, 2022, 4:04pm UTC](https://forum.dynamobim.com/t/remove-extra-digits/83298/19 "2022-12-04T16:04:24Z")

</div>

Thank you!!!
