All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.insanusmokrassar.AutoPostTelegramBot.utils.extensions.Any.kt Maven / Gradle / Ivy

Go to download

It is base library for creating smart bot for simple management of channels posts

There is a newer version: 1.7.0
Show newest version
package com.github.insanusmokrassar.AutoPostTelegramBot.utils.extensions

import kotlin.math.ceil

inline fun  List.toTable(columns: Int): Array> {
    val rows = ceil(size.toFloat() / columns).toInt()
    return (0 until rows).map {
        try {
            subList(it * columns, (it + 1) * columns).toTypedArray()
        } catch (e: IndexOutOfBoundsException) {
            subList(it * columns, size).toTypedArray()
        }
    }.toTypedArray()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy