How to replace a string in code

Hi,

I have to replace a application name at multiple places in the code.Is there a short way to do it or is it that we have to search where ever that app is used,then we will change it manually there.

1 Like

Hi,
Didn’t get what exactly you mean it.
If your looking to change the variable name which is been used multiple place then you could change it from Variable pane(one time job).
OR
If your looking to change the value of variable it then it’s same steps just pass the value in default option.

Hi,

Its not a variable.Just a app name in selector.Ex:-1:
app =‘abc.exe’
This has been used at more than 100 times.
Now I want it as app=‘def.exe’ at all the places.

Hey,

A selector can be set as a string variable. Therefore if you want to change a small part of it you could copy out your selector and then use string concatenation to amend a part of it.

so:

“selector is here” & stringVariable & “more selector here if you need it”

Hope that helps.

oh :roll_eyes: You should have created variable before and then its easy to pass the variable in selector
app=‘“+varAppName+”’ and chaning the value of it in variable pane.
But now it seems you need to change in all the place manually.
Just to save little time you could pass the entire selector to the variable and then pass that variable in each selector. :wink: (rather than opening selector editor and passing “def.exe”)

Open the xaml in text editor and do a text replace. If you’re using notepad++, you can open multiple and replace in all of them at once. Do a backup before of course.
For future solutions what others said.

4 Likes

Thanks @andrzej.kniola that helped.

1 Like