Jasmin Fajkic
08/15/2022, 4:29 PMpath.replace("/^\\/|\\/\$/g".toRegex(), "")
does not work.
2. what is easiest way to get search params as key value pair. /path/something?boom=true&id=bam. Want to have search params like boom:true , id: bam?Landry Norris
08/15/2022, 4:31 PMpath.trimStart('/')
, which will remove all slashes at the start of the string.ephemient
08/15/2022, 4:34 PMpath.removePrefix("/")
to remove just one. the problem with your code is that you are including the /
delimiters. you would have the same issue if you wrote RegExp("/^\\/|\\/\$/g")
in JS too.ephemient
08/15/2022, 4:37 PMURLSearchParams
class that exists in JS. on Kotlin/JVM there's a few optionsJasmin Fajkic
08/15/2022, 5:16 PMFrancesc
08/15/2022, 5:57 PMJasmin Fajkic
08/15/2022, 8:04 PM