mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 23:00:31 +05:30
11 lines
254 B
Kotlin
11 lines
254 B
Kotlin
package com.github.libretube.extensions
|
|
|
|
/**
|
|
* Read a string as long as the char is a digit and return the number value as int
|
|
*/
|
|
fun String?.getWhileDigit(): Int? {
|
|
return orEmpty().takeWhile { char ->
|
|
char.isDigit()
|
|
}.toIntOrNull()
|
|
}
|