To be aligned I'll illustrate what I got you mean you want to get distinct characters from string into array
Ex.
Input: RAMY MAHROUS
Output: {R A M Y H O U S}
correct?
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
I don't get your rule! can you please guide me with more examples to recognize its pattern
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
That's great :) I develop small method do that work you may use Regular Expression but I prefered to write my code...
MessageBox.Show(Zizi("aABD", new string[]{"A", "B"}, 0)); // No A
MessageBox.Show(Zizi("aABD", new string[] { "A", "B" }, 1)); // No B
MessageBox.Show(Zizi("aABD", new string[] { "A", "B" }, 0,1)); //No A nor B
MessageBox.Show(Zizi("aABD", new string[] { "A", "B" }, 2)); //A and B
private string Zizi(string str, string[] set, params int[] whatToNotCome)
{
string output = str;
for (int i = 0; i < set.Length; i++)
{
if (whatToNotCome.Contains(i))
output = output.Replace(set[i], null);
}
return output;
}
Got the idea or I should explain my code...?
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Zizi, please take a look on the examples above the code...
First Parameter the string, second one the set, and third you tell the method select to not show first\second\etc.. string from the set..
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276