{"action":"created","issue":{"url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/issues/44","repository_url":"https://api.github.com/repos/RedMadRobot/input-mask-ios","labels_url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/issues/44/comments","events_url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/issues/44/events","html_url":"https://github.com/RedMadRobot/input-mask-ios/issues/44","id":344414943,"node_id":"MDU6SXNzdWUzNDQ0MTQ5NDM=","number":44,"title":"Wrong mask attached after editing","user":{"login":"MrJox","id":22772586,"node_id":"MDQ6VXNlcjIyNzcyNTg2","avatar_url":"https://avatars1.githubusercontent.com/u/22772586?v=4","gravatar_id":"","url":"https://api.github.com/users/MrJox","html_url":"https://github.com/MrJox","followers_url":"https://api.github.com/users/MrJox/followers","following_url":"https://api.github.com/users/MrJox/following{/other_user}","gists_url":"https://api.github.com/users/MrJox/gists{/gist_id}","starred_url":"https://api.github.com/users/MrJox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrJox/subscriptions","organizations_url":"https://api.github.com/users/MrJox/orgs","repos_url":"https://api.github.com/users/MrJox/repos","events_url":"https://api.github.com/users/MrJox/events{/privacy}","received_events_url":"https://api.github.com/users/MrJox/received_events","type":"User","site_admin":false},"labels":[{"id":464645752,"node_id":"MDU6TGFiZWw0NjQ2NDU3NTI=","url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":{"login":"taflanidi","id":6849363,"node_id":"MDQ6VXNlcjY4NDkzNjM=","avatar_url":"https://avatars3.githubusercontent.com/u/6849363?v=4","gravatar_id":"","url":"https://api.github.com/users/taflanidi","html_url":"https://github.com/taflanidi","followers_url":"https://api.github.com/users/taflanidi/followers","following_url":"https://api.github.com/users/taflanidi/following{/other_user}","gists_url":"https://api.github.com/users/taflanidi/gists{/gist_id}","starred_url":"https://api.github.com/users/taflanidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taflanidi/subscriptions","organizations_url":"https://api.github.com/users/taflanidi/orgs","repos_url":"https://api.github.com/users/taflanidi/repos","events_url":"https://api.github.com/users/taflanidi/events{/privacy}","received_events_url":"https://api.github.com/users/taflanidi/received_events","type":"User","site_admin":false},"assignees":[{"login":"taflanidi","id":6849363,"node_id":"MDQ6VXNlcjY4NDkzNjM=","avatar_url":"https://avatars3.githubusercontent.com/u/6849363?v=4","gravatar_id":"","url":"https://api.github.com/users/taflanidi","html_url":"https://github.com/taflanidi","followers_url":"https://api.github.com/users/taflanidi/followers","following_url":"https://api.github.com/users/taflanidi/following{/other_user}","gists_url":"https://api.github.com/users/taflanidi/gists{/gist_id}","starred_url":"https://api.github.com/users/taflanidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taflanidi/subscriptions","organizations_url":"https://api.github.com/users/taflanidi/orgs","repos_url":"https://api.github.com/users/taflanidi/repos","events_url":"https://api.github.com/users/taflanidi/events{/privacy}","received_events_url":"https://api.github.com/users/taflanidi/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2018-07-25T12:04:01Z","updated_at":"2018-07-26T08:37:54Z","closed_at":null,"author_association":"NONE","body":"I have following masks set:\r\n`\r\n        self.login.affineFormats = [\r\n            \"{+7} ([000]) [000] [00] [00]\",\r\n            \"{8} ([000]) [000]-[00]-[00]\"\r\n        ]`\r\n\r\nWhen i type a phone number with +7 mask and then edit the value within ([000]) mask switches to 8 instead of +7 and then 7 is put inside ([000])"},"comment":{"url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/issues/comments/408022243","html_url":"https://github.com/RedMadRobot/input-mask-ios/issues/44#issuecomment-408022243","issue_url":"https://api.github.com/repos/RedMadRobot/input-mask-ios/issues/44","id":408022243,"node_id":"MDEyOklzc3VlQ29tbWVudDQwODAyMjI0Mw==","user":{"login":"taflanidi","id":6849363,"node_id":"MDQ6VXNlcjY4NDkzNjM=","avatar_url":"https://avatars3.githubusercontent.com/u/6849363?v=4","gravatar_id":"","url":"https://api.github.com/users/taflanidi","html_url":"https://github.com/taflanidi","followers_url":"https://api.github.com/users/taflanidi/followers","following_url":"https://api.github.com/users/taflanidi/following{/other_user}","gists_url":"https://api.github.com/users/taflanidi/gists{/gist_id}","starred_url":"https://api.github.com/users/taflanidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taflanidi/subscriptions","organizations_url":"https://api.github.com/users/taflanidi/orgs","repos_url":"https://api.github.com/users/taflanidi/repos","events_url":"https://api.github.com/users/taflanidi/events{/privacy}","received_events_url":"https://api.github.com/users/taflanidi/received_events","type":"User","site_admin":false},"created_at":"2018-07-26T08:37:54Z","updated_at":"2018-07-26T08:37:54Z","author_association":"MEMBER","body":"@MrJox optimized & simplified version:\r\n\r\n```swift\r\nextension String {\r\n    \r\n    func prefixIntersection(with string: String) -> Substring {\r\n        var lhsIndex = startIndex\r\n        var rhsIndex = string.startIndex\r\n        \r\n        while lhsIndex != endIndex && rhsIndex != string.endIndex {\r\n            if self[...lhsIndex] == string[...rhsIndex] {\r\n                lhsIndex = index(after: lhsIndex)\r\n                rhsIndex = string.index(after: rhsIndex)\r\n            } else {\r\n                return self[..<lhsIndex]\r\n            }\r\n        }\r\n        \r\n        return self[..<lhsIndex]\r\n    }\r\n    \r\n}\r\n```"}}
{"actor":{"display_login":"taflanidi"}}