CIString

final class CIString extends Ordered[CIString] with Serializable

A case-insensitive String.

Two CI strings are equal if and only if they are the same length, and each corresponding character is equal after calling either toUpper or toLower.

Ordering is based on a string comparison after folding each character to uppercase and then back to lowercase.

All comparisons are insensitive to locales.

Caution: the definition of equality and .toString are inconsistent with the property of substitutability, which states that if x == y, then f(x) == f(y). This does not break the contract of .equals nor the laws of cats.Eq, but can be surprising:

scala> val x = CIString("woof")
val x: org.typelevel.ci.CIString = woof
scala> val y = CIString("WOOF")
val y: org.typelevel.ci.CIString = WOOF
scala> def f(ci: String): CIString = ci.toString
def f(s: String): org.typelevel.ci.CIString
scala> x == y
val res0: Boolean = true
scala> f(x) == f(y)
val res1: Boolean = false
Value parameters:
toString

The original value the CI String was constructed with.

Companion:
object
Source:
CIString.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

override def compare(that: CIString): Int
Definition Classes
Source:
CIString.scala
override def equals(that: Any): Boolean
Definition Classes
Any
Source:
CIString.scala
override def hashCode(): Int
Definition Classes
Any
Source:
CIString.scala

Deprecated methods

@deprecated("Use toString", "0.1.0")
Deprecated
Source:
CIString.scala

Inherited methods

def <(that: CIString): Boolean
Inherited from:
Ordered
def <=(that: CIString): Boolean
Inherited from:
Ordered
def >(that: CIString): Boolean
Inherited from:
Ordered
def >=(that: CIString): Boolean
Inherited from:
Ordered
def compareTo(that: CIString): Int
Inherited from:
Ordered

Concrete fields

override val toString: String