#2212 Uri.getRange()

SlimerDude Wed 27 Nov 2013

Hi, I was playing with Uris ( again ) and I noticed this:

`/index`.getRange(-1..-1)     --> /index
`/top/index`.getRange(-1..-1) --> index

Given both uri's start with a slash, should not both results also start (or not) with a slash...?

brian Fri 29 Nov 2013

The rules are pretty simple actually and tend to work the way you want:

  • if you include first index then you get everything to the left (scheme, host, leading slash); otherwise its a relative path
  • same thing if you query last index, then you get fragment, query; otherwise it is stripped

Login or Signup to reply.