# BIGINT from string

**URL:** <https://forum.xojo.com/t/bigint-from-string/15396>\
**Category:** General\
**Created:** [April 1, 2014, 12:09pm UTC](https://forum.xojo.com/t/bigint-from-string/15396 "2014-04-01T12:09:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [April 1, 2014, 12:09pm UTC](https://forum.xojo.com/t/bigint-from-string/15396/1 "2014-04-01T12:09:09Z")

</div>

I need to convert a string to an Int64 but cant find an easy way:

```auto
dim s as string = 9223372036854775807"
```

This produce rounding errors, due to the floating point:

```auto
dim i as Int64 = val(s)
```

This doesnt work:

```auto
dim i as Int64 =CType(s, Int64)
```

This works, but seems dumb to pass from a variant to convert it:

`dim v as variant = s
dim i as Int64 = v.Int64Value`

Any ideas?

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [April 1, 2014, 12:32pm UTC](https://forum.xojo.com/t/bigint-from-string/15396/2 "2014-04-01T12:32:15Z")

</div>

dim s as string = “9223372036854775807”  
dim i as Int64 = clong(s)

seems to work.

---

<div class="post-metadata">

**Author:** ![Massimo\_Valle](https://forum.xojo.com/user_avatar/forum.xojo.com/massimo_valle/32/23049_2.png) [@Massimo\_Valle](https://forum.xojo.com/u/Massimo_Valle)\
**Post date:** [April 1, 2014, 12:45pm UTC](https://forum.xojo.com/t/bigint-from-string/15396/3 "2014-04-01T12:45:11Z")

</div>

Ups! Never imagined about CLong.  
Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:09pm UTC](https://forum.xojo.com/t/bigint-from-string/15396/4 "2020-10-29T17:09:08Z")

</div>


