coder82
06/14/2018, 8:13 PMcoder82
06/14/2018, 8:13 PMcoder82
06/14/2018, 8:14 PMdumptruckman
06/14/2018, 8:15 PMdumptruckman
06/14/2018, 8:15 PMpniederw
06/14/2018, 8:21 PMHullaballoonatic
06/14/2018, 8:25 PMHullaballoonatic
06/14/2018, 8:26 PMcoder82
06/14/2018, 8:36 PMcoder82
06/14/2018, 8:37 PMcoder82
06/14/2018, 9:45 PMbissell
06/14/2018, 10:04 PMrook
06/14/2018, 10:06 PMCzar
06/14/2018, 10:07 PMHullaballoonatic
06/14/2018, 10:07 PMHullaballoonatic
06/14/2018, 10:07 PMbudioktaviyan
06/14/2018, 10:09 PMwei
06/14/2018, 10:30 PMa
and b
. I want to check if they are both null
or empty
or if not, then if they are equal, i.e., if a = "" || a?.isEmpty()
and b = null || b.isEmpty()
or a == b
then I want to return true.
Simply doing a == b
won’t work for a = ""
and b = null
case.
What’s the cleanest way to express this?Shawn
06/14/2018, 10:33 PM.isNullOrEmpty()
Shawn
06/14/2018, 10:33 PM"" == null
work? they aren’t equal, and it returns falsewei
06/14/2018, 10:35 PM""
and null
mean the same, so I want to return trueShawn
06/14/2018, 10:36 PMkarelpeeters
06/14/2018, 10:37 PMwei
06/14/2018, 10:42 PMa == b || (a.isNullOrEmpty() && b.isNullOrEmpty())
Shawn
06/14/2018, 10:45 PMShawn
06/14/2018, 10:57 PMnull eq null
compiling when I declared the function on String?
- I was under the impression that without any hinting or anything, null
would resolve to methods on Nothing?
karelpeeters
06/14/2018, 10:59 PMnull
is a value that fits the type String?
, so it should work.jimn
06/15/2018, 1:03 AMcygnus
06/15/2018, 1:44 AM