# Convert string to number with decimal

**URL:** https://discuss.elastic.co/t/convert-string-to-number-with-decimal/262163
**Category:** Logstash
**Created:** [January 25, 2021, 7:50pm UTC](https://discuss.elastic.co/t/convert-string-to-number-with-decimal/262163 "2021-01-25T19:50:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jayv](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jayv](https://discuss.elastic.co/u/jayv)
#### Post date: [January 25, 2021, 7:50pm UTC](https://discuss.elastic.co/t/convert-string-to-number-with-decimal/262163/1 "2021-01-25T19:50:55Z")

</div>

Hi there, can anyone help me mutate a string into a decimal-formatted number for geo-points?

For example, I have a CSV with fields containing: **-115168598**

....which needs to be: **-115.168598**

My first attempt just gave me **-115** :

`ruby {code => "event.set('Ypos', event.get('Ypos')/1000000)"}`

Thank you.

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [January 25, 2021, 11:15pm UTC](https://discuss.elastic.co/t/convert-string-to-number-with-decimal/262163/2 "2021-01-25T23:15:17Z")

</div>

I have not tested it, but you could try

```
ruby {code => "event.set('Ypos', event.get('Ypos').to_f/1000000)"}
```

---

<div class="post-metadata">

### Author: ![jayv](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jayv](https://discuss.elastic.co/u/jayv)
#### Post date: [January 27, 2021, 4:42pm UTC](https://discuss.elastic.co/t/convert-string-to-number-with-decimal/262163/3 "2021-01-27T16:42:26Z")

</div>

Thank you!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 24, 2021, 4:42pm UTC](https://discuss.elastic.co/t/convert-string-to-number-with-decimal/262163/4 "2021-02-24T16:42:30Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
