# Get Value from the starting of numbers

**URL:** <https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303>\
**Category:** Questions about Thunkable X\
**Created:** [July 28, 2020, 6:51am UTC](https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303 "2020-07-28T06:51:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tobi/32/70526_2.png) [@tobi](https://community.thunkable.com/u/tobi)\
**Post date:** [July 28, 2020, 6:51am UTC](https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303/1 "2020-07-28T06:51:38Z")

</div>

I have been searching this for a long time. So, finally I have to make this topic.

Actually,  
I have a value (eg. 123456789). I want to code that if the value starts with numbers **123** then do specific action. I do not know how to do this.

Any Ideas?

PLease help!

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [July 28, 2020, 7:00am UTC](https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303/2 "2020-07-28T07:00:38Z")

</div>

If you want to get a ready-made example, then wait for the responses of others. If you are interested in finding out for yourself, there is a simple algorithm for this:

1. Spend time and understand how all the blocks work on the block palette
2. when solving the problem, use a dialog with yourself:

-I have a data string. How do I perform an action if it starts with 123?  
-To do this, you need to get the first 3 characters from the string and compare them with 123

-How do I do that?  
-You need to find a block that can be used to get a substring from a string

-Okay, what if I need the line to start with 12345?  
-Then you need to search for a substring depending on its length

-How do I find out the length of a substring?  
-To do this, find a block that returns the number of characters in the string passed to it

and so on.

---

<div class="post-metadata">

**Author:** ![tobi](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tobi/32/70526_2.png) [@tobi](https://community.thunkable.com/u/tobi)\
**Post date:** [July 28, 2020, 7:20am UTC](https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303/3 "2020-07-28T07:20:33Z")

</div>

Thanks @actech,  
You have described well. I am going to try this **NOW!**

---

<div class="post-metadata">

**Author:** ![gpo](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@gpo](https://community.thunkable.com/u/gpo)\
**Post date:** [August 6, 2020, 2:25pm UTC](https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303/4 "2020-08-06T14:25:42Z")

</div>

What about the case in which I want to delete the last 10 characters of a variable length string? For example, “address” is variable in length, but “state, zip, country” are always the same length and I would like chop those off and just show “street, city.” Thank you for any help. And thank you actech for your demos. They are great.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:26pm UTC](https://community.thunkable.com/t/get-value-from-the-starting-of-numbers/706303/5 "2024-11-08T12:26:48Z")

</div>


