Sha256: bf93b6be65697b89e1d1f372fd6af7bf69c7ea9550dfcb99e34637f40e621ebd

Contents?: true

Size: 711 Bytes

Versions: 188

Compression:

Stored size: 711 Bytes

Contents

struct Series {

    var numberString = ""

    init(_ numString: String) {
        self.numberString = numString
    }

    func slices(_ chunkSize: Int) -> [[Int]] {
        var numberStringArray = Array(numberString.characters).map { Int("\($0)") ?? 0 }
        let count = numberStringArray.count
        var start = 0
        var end = chunkSize
        var tempArrayReturn = [[Int]]()

        let enumarated = (0..<(count)).enumerated()

        for (_, _) in enumarated where end < (count + 1) {
            let tempArray = Array(numberStringArray[start ..< end])
            tempArrayReturn.append(tempArray)
            start += 1
            end += 1
        }
        return tempArrayReturn
    }
}

Version data entries

188 entries across 188 versions & 1 rubygems

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