How to replace text with numbers

i have a text in label = ABCD
i want to replace this text in text box 2 with numbers
A=1 , B=2 , C=3 ,D=4
RESULT TO GET IN TEXT BOX 2 = 1234

You can loop through each character in the text string:

Set app variable character list to [make list from text] Label1's Text with delimiter "" (empty string). 
For i=1 to length of [app variable character list] by 1
   If list item #i = "A"
      set list item #i to 1
   If list item #i = "B"
      set list item #i to 2
   If list item #i = "C"
      set list item #i to 3
   If list item #i = "D"
      set list item #i to 4
Set Label2's Text to [make text from list] app variable character list with delimiter ""

If you have trouble getting that to work, post a screenshot of the blocks you’ve tried.

i dont understand this coding language , please can you do this with block design and reply , pleaseeeeeeeee

please make this in block design , i dont understand this coding language , pleaseeee

THIS IS NOT WORKING , IF I CHANGE THE TEXT IN LABEL 1 = DCBA , THEN THE RESULT I SHOULD GET IS 4321
I TRIED THIS BELOW CODE AND RESULT IS WRONG


2023-10-01 - 13-57-13 - Thunkable

It should be get #1 not directly label1’s text

you can try these blocks:

here’s a sample output:
image

here’s the link to the project (see SCREEN11)
https://x.thunkable.com/copy/cb18983152bdcd99c8deabc1174ab877

1 Like

you could use this too if you want:

Your blocks are doing exactly what you told them to do…

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