> is there better way to do that
Sure is. You only need to split the string once, so create a string array
variable, and use that array in your loop. It prevents the recurring split,
which will consume a lot of resources creating arrays of strings that are
constantly being thrown away.
In fact, assumming that you want to use the lettters of the English alphabet
(or any alphabet, for that matter), as you do in your example, you don't
need an array of strings at all. You can create each letter in the alphabet
using its numerical value. As each letter has a numerical value that is
sequential, you can apply math to a single numerical value to get each
letter. This can be done by casting an integer to a char.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.
"Raed Sawalha" <Ra*********@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I have the following letters;
string letters = "a;b;c....to z";
the I need to replace the incoming string which containing letters above
with integer 1 i did following
for(int u=0;u<letters.Split(';').Length;u++) {
FilesName = FilesName.Trim().Replace(letters.Split(';')[u], "1");
}
is there better way to do that