Not only can you add extension functions to regular types, but you can add
them on nullable editions of the types, just by adding ?
at the end of the
type name.
In this snippet, we have isValidEmail()
defined on String?
, so we can
call isValidEmail()
on null
as well as on an actual string.
You can learn more about this in:
Tags: