I have two string and i need to find out the number of matching character at the same position into the strings. Ex- 1010 and 1100, two character have matched at position 1 and 4. Is there any way to find out it easily in swift?
I have placed each character in an array of the first string and tried to mach like--
for chr in string2 {
if chr == array[i] {
count += 1
}
}
That was my approach but if there any easiest solution.