I have two string arrays which are:
string[] abecele = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "w", "x", "y", "z", ".", ",", "!", "?", "(", ")", "@", " " };
string[] keitiniai = { "714", "741", "147", "471", "417", "174", "789", "798", "897", "978", "879", "987", "123", "321", "132", "312", "213", "231", "852", "258", "825", "285", "582", "528", "951", "159", "915", "195", "519", "591", "753", "357", "000" };
Then I have a string named tekstas, which takes some rondom text from maskedTextBox:;
tekstas = maskedTextBox1.Text
Now I need that characters which are in abecele[] array IN THAT TEXT would be changed to keitiniai arrays values, like if we had such text “abc” in tekstas string it would become 714741147.
Im using such code to implement that:
for (i = 0; i < 32; i++)
{
string raide = abecele[i];
string keitinys = keitiniai[i];
string pakeistas = tekstas.Replace(raide, keitinys);
}
But new string pakeistas which should be replaced as I want is not replaced. Where is the problem?
At the moment you’re discarding the “replacements made” string each time. You probably want the following: