Hi all! I've got a function that has optional stri...
# announcements
u
Hi all! I've got a function that has optional string parameters, I'd like to do a template substitution based on whether those are passed or not, e.g.:
Copy code
fun x(a: String, b: String?, c: String?) {
   val myString: String = "<http://examples.com/$a?b=$b&c=$c>" ?: "<http://examples.com/$a>"
}
When I try that I get a message that the elvis operator will always return the LHS despite the fact that `b`/`c` can be null. Is there any succinct way to do this?