Replace string parsing logic with native Uri methods