isNotEmpty

Returns true if this char sequence is not empty.

Since Kotlin

1.0

Samples

import java.util.Locale
import kotlin.test.*

fun main() { 
   //sampleStart 
   fun markdownLink(title: String, url: String) =
    if (title.isNotEmpty()) "[$title]($url)" else url

// plain link
println(markdownLink(title = "", url = "https://kotlinlang.org")) // https://kotlinlang.org

// link with custom title
println(markdownLink(title = "Kotlin Language", url = "https://kotlinlang.org")) // [Kotlin Language](https://kotlinlang.org) 
   //sampleEnd
}