string manipulation
how to find out which character is similar between two string
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Oct 11, 2014, 7:51 PM
The output is:
The common characters are : strng
Munesh SharmaPosted Oct 11, 2014, 1:08 AM
{
bool[] matchedFlag = new bool[s2.Length];
for (int i1 = 0; i1 < s1.Length; i1++)
{
for (int i2 = 0; i2 < s2.Length; i2++)
{
if (!matchedFlag[i2] && s1.ToCharArray()[i1] == s2.ToCharArray()[i2])
{
matchedFlag[i2] = true; break;
} }
}
return matchedFlag.Count(u => u);
}