DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
kesprit profile image
kesprit

Swift

func removeFirstAndLastLetter(value: String) -> String? {
    guard value.count > 3 else { return nil }
    var result = value.dropFirst()
    result.popLast()
    return String(result)
}
Forem Open with the Forem app