I have an issue where I try to String.Replace words that starts the same way, f.ex. “Level 1” and “Level 10”. So when I have “Level 10”, String.Replace recognizes it as “Level 1” and replaces the string according to “Level 1”.
So when String.Replace is searching for “Level 1”, it also detects “Level 10” and replaces it accordingly to Level 1.
How do I avoid this?
Sorry @Nico_Stegeman, I might have explained it wrongly. Let me make an edit.
You are right, when it comes to replacing “Level 10”, it does replaces it correctly. But when it comes to replacing “Level 1”, then it also replaces strings “Level 10” because it actually contains that value it is searching for.
See picture with yellow marks.
Not at the PC but you could assess another condition in the form of “String.Length” to check if the value Level 10 is longer than Level 1. Kind of like a sub filter.
There will be lots of other ways to do this of course.
@Nico_Stegeman no, it does not solves the problem. I cannot use First.Item because sometimes I have many “Level 1” strings with other suffixes. See picture.
@jacob.small thank you, but not sure how this helps me. You seem to focus on getting strings containing “Level 1” , but I also though need to rename all other strings. Here is picture and .dyn with your method.