# Cut off digit from Integer

**URL:** <https://discourse.processing.org/t/cut-off-digit-from-integer/1446>\
**Category:** Beginners\
**Created:** [July 2, 2018, 9:00pm UTC](https://discourse.processing.org/t/cut-off-digit-from-integer/1446 "2018-07-02T21:00:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.processing.org/u/Daniel)\
**Post date:** [July 2, 2018, 9:00pm UTC](https://discourse.processing.org/t/cut-off-digit-from-integer/1446/1 "2018-07-02T21:00:59Z")

</div>

Hi,

I have a list of postcodes and I wanna cut off the first digit of each code.  
If I have the postcodes “85463” for example, I want to cut off the “8” and write it into a variable.

Is that possible? The substring() function won’t work since I’m working on an Integer.

Thanks,  
Daniel

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 2, 2018, 9:07pm UTC](https://discourse.processing.org/t/cut-off-digit-from-integer/1446/2 "2018-07-02T21:07:50Z")

</div>

```auto
println(85463/10000); //Testing 5 digits

println(10/10000); //Testing less than 5 digits

```

Output

> 8  
> 0

Kf

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 2, 2018, 9:36pm UTC](https://discourse.processing.org/t/cut-off-digit-from-integer/1446/3 "2018-07-02T21:36:22Z")

</div>

```auto
int code = 85463;
char firstDigit = str(code).charAt(0);

println(firstDigit); // 8
exit();

```
