Inout parameters in swift 3
<p>This is my code:</p>

<pre><code>func removeFromString( _ s: inout String, Character c:Character) -&gt; Int {
    var s1 = s
    var nRemoved = 0

    while let ix = s1.characters.index(of: c) {
        s1.removeSubrange(ix...ix)
        nRemoved += 1

    }
    return nRemoved
}

var s2 = "everest"

let resb = removeFromString(&amp;s2, Character: Character("e"))
</code></pre>

<p>My problem is this is supposed to change s2 to <strong>"vrst"</strong> after using the <code>inout</code> parameter <code>s</code>. But it's not modifying the <code>var s2</code> at all. What wrong I'm I doing? Or I'm expecting a wrong output? Do help. Thanks.</p>