# Pull numbers out of a string

**URL:** <https://forum.kirupa.com/t/pull-numbers-out-of-a-string/324127>\
**Category:** flash\
**Created:** [August 3, 2011, 5:25pm UTC](https://forum.kirupa.com/t/pull-numbers-out-of-a-string/324127 "2011-08-03T17:25:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewlong](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@andrewlong](https://forum.kirupa.com/u/andrewlong)\
**Post date:** [August 3, 2011, 5:25pm UTC](https://forum.kirupa.com/t/pull-numbers-out-of-a-string/324127/1 "2011-08-03T17:25:07Z")

</div>

I need to pull numbers out of a string. I can easily iterate over all the characters, but the problem I am having is that often the numbers are zeroes. Is there a way to convert a string to an integer other than casting (since int(“0”) and int(“a”) both return 0)? Basically I need to be able to differentiate between “string1string” and “string10string”.
