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-1.0.4.1 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.4.0 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.3.0 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.2.1 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.2.0 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.1.2 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.1.1 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.1.0 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.0.1 tracks/swift/exercises/series/SeriesExample.swift
trackler-1.0.0 tracks/swift/exercises/series/SeriesExample.swift