String Replace Multiple | Codeblock

Hi,

I’m trying to make this script work properly. It’s only replacing the string with a very first string item. See pic.
Not sure where the problem is. Maybe levels or lacing? Anything helps.

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;
};

Hi @zalgirietis.minde

Add List.Cycle along with List.Count and you should be good:

2 Likes

Thanks! Exactly as I wanted!