Sha256: 95ab4b1f32dfa3716df4ae111891660b14d41f2b4d8169cd2ba83c8a8dc5150c

Contents?: true

Size: 746 Bytes

Versions: 130

Compression:

Stored size: 746 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 {
            if end < count+1 {
                let tempArray = Array(numberStringArray[start ..< end])
                tempArrayReturn.append(tempArray)
                start += 1
                end += 1
            }
        }
        return tempArrayReturn
    }
}

Version data entries

130 entries across 130 versions & 1 rubygems

Version Path
trackler-2.0.8.30 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.29 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.28 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.27 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.26 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.24 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.23 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.22 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.21 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.20 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.19 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.18 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.17 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.16 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.15 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.14 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.13 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.12 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.11 tracks/swift/exercises/series/Sources/SeriesExample.swift
trackler-2.0.8.10 tracks/swift/exercises/series/Sources/SeriesExample.swift