# Find the position of a single non-matching character between two strings

**URL:** <https://discourse.julialang.org/t/find-the-position-of-a-single-non-matching-character-between-two-strings/86560>\
**Category:** General Usage\
**Tags:** strings, unicode\
**Created:** [August 30, 2022, 5:07pm UTC](https://discourse.julialang.org/t/find-the-position-of-a-single-non-matching-character-between-two-strings/86560 "2022-08-30T17:07:38Z")\
**Posts on this page:** 1\
**Showing post:** 25

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 30, 2022, 8:02pm UTC](https://discourse.julialang.org/t/find-the-position-of-a-single-non-matching-character-between-two-strings/86560/25 "2022-08-30T20:02:38Z")

</div>

> [@rocco\_sprmnt21](#):
>
> Regarding correctness, I point out that a “simpler” solution was required to the problem of finding the position of a SINGLE non-matching character, not the first of many non-matching characters.

It also fails this test:

```julia
julia> s1, s2 = "zzzz", "zzzx"
("zzzz", "zzzx")

julia> findfirst(==(only(setdiff(s1,s2))), s1)
ERROR: ArgumentError: Collection is empty, must contain exactly 1 element

```

---

_[View the full topic](https://discourse.julialang.org/t/find-the-position-of-a-single-non-matching-character-between-two-strings/86560)._
