There must be a nicer way to do this… ```private f...
# codereview
e
There must be a nicer way to do this…
Copy code
private fun createSearchIntent(mr: MatcherResult) = 
    mr.slots[THING_KEY]?.let { thing ->
        val suffix = mr.slots[LOCATION_KEY]?.let { "in $it" } ?: ""
            Intent(
                 Intent.ACTION_VIEW,
                 Uri.parse("navigation:q=$thing$suffix")
             )
    }
c
You’re parsing a string with a potential space in it - Just wanted to check if this was intentional since the
$thing$suffix
suggests you don’t want white space 🙂
e
Oh yeah, it looks like there should be a space at the start of
"in it"
. (All the spaces will be handled by
Uri.parse()
.) Thanks for pointing that out!
👍 1