Change any letters from a text

Hi everybody,
i’ve been struggling with this over the past three days and can’t sort it out.

I need to modify all the letters of a text into something else, in this case is an “underscore” like an hint for a quiz that gives you the exactly numbers of letters in the solution.
Example: Solution is “France” (which is in global variable so it changes everytime) and need to convert into “_____”
I have watched loads of tutorials but all of them are showing how to convert a certain known letter to another one and this is not helping me.
I have tried “for each item in list” “for each number in list” using the replace all text with no luck at all.
Still gives me just one “_” or “U_n_i_t_e_d_S_t_a_t_e_s”

And the problem will be bigger with answers that cointains 2 or more words.

Another solution i tried was to calculate how many letters are in the word, but it gets complicated when “spaces” comes in and i have no idea how to set “_” moltiplied for “numbers of letters” except variables spaces.

blocks (5)
blocks (4)

These are just few blocks i have tried, my blocks editor are full of strings trying to solve this.

Thank you very much in adavance!

Do you want it like this
France = ______
United States = ______ ______

Yes, exactly like that:
France, 5 letters, 5 underscores.
United States, 12 lettere, 6underscores space 6 underscores.

i hope this is going to help to determinate the first letter of the solution too, in order to give it as second hint for guessing the word:
F____
U_____ S_____

But obviously this comes later

Do it whith variables

yosh

The only thing it comes up in mind is to get the lenght of the “solution” and:

If lenght-solution = 5
Then set TextBox.Text to “_ _ _ _ _ "
If lenght-solution = 4
Then set TextBoc.Text to "
_ _ _”

But there are more then 50 solutions, it will be an hard work, im sure there’s a much easier way.
Also it cant allow me to get the second hint:
“F_ _ _ _ _”

This is also a great example of a hangman game.

2 Likes

I started the project before Peter’s answer. I don’t know if it’s the same as the video.

3 Likes

Actually i missed something. I placed a space at the end of the result word

4 Likes

Thanks everybody for your help! it works great!

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