[Solved] replacing words using array without using IF conditional, etc


I would use the string functions for replace and a dictionary for the assignments.

here is a simple example:

string array1 = "@ABC";

Dictionary<char, char> dict = new Dictionary<char, char>() { { '@', 'P' }, { 'A', 'Q' }, { 'B', 'R' }, { 'C', 'S' }};

foreach(var item in dict){
    array1 = array1.Replace(item.Key, item.Value);}

solved replacing words using array without using IF conditional, etc