hi! i want to remove the first “and” from a string. sometimes it works, sometimes it doesnt when i do Confirmation2Banks.Substring(2).Trim, where Confirmation2Banks = Confirmation2Banks + " and " + BankNames.
is there a better solution for this that will allow me to always remove the first “and”?
We create a regex replace where we first pass the Pattern which we want to replace. In .Replace we pass the string where we will replace, for which other string we will replace and the index of ocurrance.
Hey Aly, I think what might be happening is that Replace might be called multiple times for your text (perhaps by loop), in which case it’s taking out all the “ands” 1 to 1.
I believe that debugging a little, you can make the method only run once in your text.