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

commonMain.com.fleeksoft.ksoup.internal.Normalizer.kt Maven / Gradle / Ivy

Go to download

Ksoup is a Kotlin Multiplatform library for working with HTML and XML, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.

The newest version!
package com.fleeksoft.ksoup.internal

/**
 * Util methods for normalizing strings. Ksoup internal use only, please don't depend on this API.
 */
internal object Normalizer {
    /** Drops the input string to lower case.  */
    fun lowerCase(input: String?): String {
        return input?.lowercase() ?: ""
    }

    /** Lower-cases and trims the input string.  */
    fun normalize(input: String?): String {
        return lowerCase(input).trim { it <= ' ' }
    }

    /** If a string literal, just lower case the string; otherwise lower-case and trim.  */
    fun normalize(
        input: String?,
        isStringLiteral: Boolean,
    ): String {
        return if (isStringLiteral) lowerCase(input) else normalize(input)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy