'Replace All Text' Block - How to match EXACT occurences?

Hello,

I am making an App, in which there is a table with many numbers.
Everytime I click a button, it should speak out a random number from that table's text part, and then cross that number out. I am using a Replace all Text block for this.

My problem: (I am explaining it by giving an example because it is easier that way)

For Example, if the random number is 1. It would cross out the number one, but would also cross out the 1 from 10. It will make the 1 as X, but the 10 will become X0.

I want it to cross out the full 10

How do I solve this?

Here is my code:
image

The output problem:

Thanks

Use the contains block for each item in the list:

image

Do you want to keep XX in the list as a place holder for the 10?

I didn't really understand what you meant.

My App has numbers from 1 to 100, not only till 10. I kept it till ten just for trial.

and what difference will that make ?

That I will have to put all the numbers 1,2,3,4,5,6,7,8,9 in it.

Also, the output shouldn't be a list, it should be a CSV format text like I put in the starting.

If your list starts out with 1,..., 100 and you cross out all '1's, how many items should the resulting list contain?

  • 100, or
  • approximately 80?

I guess so

1 Like

Sometimes I have run into this situation.

If you want or have to work with a text string, you must make each element unique. For example, I insert marks at the beginning and end and when I want to make the substitution, I do it on the mark.

blocks_replacement

However, I recommend that you use lists. Note that you have the "join items using separator" function that would allow you to re-create the CSV.

Besides, if it is a list from 1 to 100, it will be easy to position yourself directly on the element to be replaced.

Can I use a Space for this?

Or a Blank Unicode character for this? Like this

This was a Perfect Solution. I used the Hangul Filler Character (Which is Basically a blank Character) for it.

Thanks !

1 Like

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