# How to split a text string with \\n

**URL:** <https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748>\
**Category:** Questions about Thunkable X\
**Created:** [April 8, 2023, 5:54pm UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748 "2023-04-08T17:54:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)\
**Post date:** [April 8, 2023, 5:54pm UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/1 "2023-04-08T17:54:03Z")

</div>

So I have this little program:  
[https://x.thunkable.com/copy/c7c3ff1292aae95ed0bf004c9077893a](https://x.thunkable.com/copy/c7c3ff1292aae95ed0bf004c9077893a)  
This is how the UI looks:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/f/bf39e2eb781787f352c609984021a70dc9c023ea.png)

I dont understand how the - " for each Item j in list works". When I type in a bunch of numbers in a rows I want each of the numbers I typed to get initialized to the five variables num1 - num5

thanks

ananda

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 8, 2023, 9:18pm UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/2 "2023-04-08T21:18:09Z")

</div>

Sorry, I’m on my phone and can’t look through your blocks but if you’re trying to store user inputs, you would insert each input as the last item in a list variable using this block: [Lists - Thunkable Docs](https://docs.thunkable.com/lists#insert-at-set)

You would only need the “for each item in list” block if you are trying to retrieve the values from that list using a loop.

---

<div class="post-metadata">

**Author:** ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)\
**Post date:** [April 8, 2023, 11:45pm UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/3 "2023-04-08T23:45:41Z")

</div>

> > You would only need the “for each item in list” block if you are trying to retrieve the values from that list using a loop.  
> > Exactly that is what I want to do. What do I put in the the set app variable Num1 etc … that is where I got stuck. Or my usage might be wrong.
> > 
> > ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/9/2912c06a26e16bdea356eb426806d5e9682f0c03.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 8, 2023, 11:50pm UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/4 "2023-04-08T23:50:52Z")

</div>

~~The `make list from text` block will create a string. So `app variable InputList` is going to be a list of strings. For example, if Input’s Text is “1,2,3,4,5” then `app variable InputList` would be {“1”,“2”,“3”,“4”,“5”}.~~

 

~~But you’re checking to see if j=1, j=2, j=3, etc. Try instead checking if j=“1”, j=“2”, j=“3”, etc.~~

**Edit:** actually, that doesn’t seem to matter. It can match j=1, j=2, j=3, etc. just fine.

Can you explain what you’re trying to do with your `for each item` loop? What are you wanting to display if j=“1”, etc.? It’s not clear to me what your overall goal is.

---

<div class="post-metadata">

**Author:** ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)\
**Post date:** [April 9, 2023, 12:13am UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/5 "2023-04-09T00:13:39Z")

</div>

My bad my bad. Just talking it over with you and reading your comments and questions answered my question. All I wanted to read a text string and get numbers out of it separately. Sorry I should have figured it out myself … too much sleep lost on the product. April 18th is the deadline for Technovation hence the stress 🙂 🙂 Thanks again

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 9, 2023, 12:24am UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/6 "2023-04-09T00:24:24Z")

</div>

Okay, most likely you just need to do `set Output's Text to j` within the `for each j in list` loop, along with a wait block.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [July 8, 2023, 12:24am UTC](https://community.thunkable.com/t/how-to-split-a-text-string-with-n/2363748/7 "2023-07-08T00:24:45Z")

</div>

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