String comparison: Difference between revisions

Content added Content deleted
(Added FreeBASIC)
(Added Kotlin)
Line 1,339: Line 1,339:


jq has an extensive library of built-in functions for handling strings. The most recent versions of jq (since 1.4) also have extensive support for PCRE regular expressions (regex), including named captures. Please see [http://stedolan.github.io/jq/manual/#Builtinoperatorsandfunctions|jq Builtin Operators and Functions] for details.
jq has an extensive library of built-in functions for handling strings. The most recent versions of jq (since 1.4) also have extensive support for PCRE regular expressions (regex), including named captures. Please see [http://stedolan.github.io/jq/manual/#Builtinoperatorsandfunctions|jq Builtin Operators and Functions] for details.

=={{header|Kotlin}}==
<lang scala>// version 1.0.6

fun main(args: Array<String>) {
val k1 = "kotlin"
val k2 = "Kotlin"
println("Case sensitive comparisons:\n")
println("kotlin and Kotlin are equal = ${k1 == k2}")
println("kotlin and Kotlin are not equal = ${k1 != k2}")
println("kotlin comes before Kotlin = ${k1 < k2}")
println("kotlin comes after Kotlin = ${k1 > k2}")
println("\nCase insensitive comparisons:\n")
println("kotlin and Kotlin are equal = ${k1 == k2.toLowerCase()}")
println("kotlin and Kotlin are not equal = ${k1 != k2.toLowerCase()}")
println("kotlin comes before Kotlin = ${k1 < k2.toLowerCase()}")
println("kotlin comes after Kotlin = ${k1 > k2.toLowerCase()}")
}</lang>

{{out}}
<pre>
Case sensitive comparisons:

kotlin and Kotlin are equal = false
kotlin and Kotlin are not equal = true
kotlin comes before Kotlin = false
kotlin comes after Kotlin = true

Case insensitive comparisons:

kotlin and Kotlin are equal = true
kotlin and Kotlin are not equal = false
kotlin comes before Kotlin = false
kotlin comes after Kotlin = false
</pre>


=={{header|Lasso}}==
=={{header|Lasso}}==