i am trying to swipe multiple items in a string but its partially working.
Hi Roy,
You can also consider using DesignScript if you don’t want to download a package.
Best regards
Thank you @mellouze. Can i copy this code block?
Sure thing You might want to replace the while loop with a for loop.
str;
search;
replace;
n = List.Count(search);
c = [Imperative]{
i=0;
result = str;
while(i<n){
result = String.Replace(result,search[i],replace[i]);
i = i+1;
}
return = result;
};
What is the error saying ?
Also, for some reason, Dynamo is interpreting List as a variable in your graph.
it says: Warning: Internal error, please report: Dereferencing a non-pointer.
i was using dynamo 1.3 which is showing error
but i tried same with 2.0.1 now this code block is working
I always worked on Dynamo 2.0.1, unfortunately i cannot fix the code for 1.3
thats fine. Thanks for help. one more thing. Can i use nodes instead? is it possible?
Did you try String.ReplaceMultiple ?
It works like a charm.
yes i tried but the problem is end of the day i need to get string from excel. i am not sure if it will work or not.
Thanks its working!!
i finally working with this and its working like a charm.
its a good alternative though. thanks for help.
If you replace List with DSCore.List it should work.
str;
search;
replace;
n = DSCore.List.Count(search);
c = [Imperative]{
i=0;
result = str;
while(i<n){
result = String.Replace(result,search[i],replace[i]);
i = i+1;
}
return = result;
};
Nice. thanks!!