Well it depends on what your uri String is. The code is valid so you should have had no problems running it.

When the above is ran, i evaluates to 7, and j evaluates to 13. The value of i is the index for the beginning of the String "/docs/", keeping in mind that the first character of s, which is "/", has an index of 0. As the above String is of length 13, that is indexes 0-12, the value for j, 13, is outside the bounds of the String length. HTH.

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com