RichUtils / pyxis.uzuki.live.richutilskt.utils / kotlin.String

Extensions for kotlin.String

createJSONArray

fun String.createJSONArray(): JSONArray?

create JSONArray from String

createJSONObject

fun String.createJSONObject(): JSONObject?

create JSONObject from String

getBitmap

fun String.getBitmap(): Bitmap?

get bitmap from filePath

getFileExtension

fun String.getFileExtension(): String

get extensions of given file path

getImageHeight

fun String.getImageHeight(): Int

get Height of Image which given String

getImageMimeType

fun String.getImageMimeType(): String

get MimeType of Image which given String

getImageWidth

fun String.getImageWidth(): Int

get Width of Image which given String

getVideoHeight

fun String.getVideoHeight(): Int

get Height of Video which given String

getVideoWidth

fun String.getVideoWidth(): Int

get Width of Video which given String

isEmpty

fun String.isEmpty(): Boolean

return string empty state

isEmptyOrReturn

fun String.isEmptyOrReturn(default: String = ""): String

get string with empty handling

isExistReadFile

fun String.isExistReadFile(): Boolean

Test given path is exists and can read

parseDate

fun String.parseDate(format: String? = "yyyy-MM-dd HH:mm:ss"): Date?

parsing date from String

safeBigDecimal

fun String.safeBigDecimal(default: BigDecimal = BigDecimal.ZERO): BigDecimal

safe cast String to BigDecimal

safeBigInteger

fun String.safeBigInteger(radix: Int = 10, default: BigInteger = BigInteger.ZERO): BigInteger

safe cast String to BigInteger

safeByte

fun String.safeByte(radix: Int = 10, default: Byte = 0): Byte

safe cast String to Byte

safeDouble

fun String.safeDouble(default: Double = 0.0): Double

safe cast String to Double

safeFloat

fun String.safeFloat(default: Float = 0.0f): Float

safe cast String to Float

safeInt

fun String.safeInt(radix: Int = 10, default: Int = 0): Int

safe cast String to Int

safeLong

fun String.safeLong(radix: Int = 10, default: Long = 0L): Long

safe cast String to Long

safeShort

fun String.safeShort(radix: Int = 10, default: Short = 0): Short

safe cast String to Short

toDateString

fun String.toDateString(fromFormat: String, toFormat: String): String

format formatted date to another formatted date

toFile

fun String.toFile(): File

make String to File