```!is``` how can we create an extension or infix ...
# android
s
Copy code
!is
how can we create an extension or infix function for
!is
to use it like`someVar isnot String`?
d
Not possible.
String
cannot be passed as a value. Unless you're okay with
someVar isnot String::class
?
s
too bad. but I mean String as an example, I wanted to use it with any generic class
d
Copy code
public inline infix fun <reified T : Any> Any?.isnot(ignored: KClass<T>): Boolean {
    return this !is T
}

public fun test() {
    val lol: Any = "Some stuff"
    if (lol isnot String::class) {
        println("Yay!")
    }
}
👍 2
s
nice
that's it
thank you
d
np