Sha256: 62f8992d15b025d5b51be426f76d6fb4e3efd87c50f10a730f318f36c2a6f198

Contents?: true

Size: 590 Bytes

Versions: 364

Compression:

Stored size: 590 Bytes

Contents

import Foundation

struct Isogram {

    static func isIsogram(_ string: String) -> Bool {
        let lowercasedString = string.lowercased()
        let lowercaseLetterSet = CharacterSet.lowercaseLetters

        var letters: Set<UnicodeScalar> = []

        for character in lowercasedString.unicodeScalars {
            guard lowercaseLetterSet.contains(character) else {
                continue
            }

            guard !letters.contains(character) else {
                return false
            }

            letters.insert(character)
        }

        return true
    }
}

Version data entries

364 entries across 364 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.179 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.178 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.177 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.176 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.175 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.174 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.173 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.172 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.171 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.170 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.169 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.167 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.166 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.165 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.164 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.163 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.162 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.161 tracks/swift/exercises/isogram/Sources/IsogramExample.swift
trackler-2.2.1.160 tracks/swift/exercises/isogram/Sources/IsogramExample.swift