Question: I need to parse a URL into an array and was having some difficulties figuring out how to do it properly. It's a bit complicated.

So my URL would be something like this:

<http://sharepoint/webname/libraryname/subfolder1/subfolder2/subfolder3/documentname>

And the results would need to be like so

```
array0 - http://sharepoint
array1 - webname
array2 - libraryname
array3 - subfolder1/subfolder2/subfolder3 
array4 - documentname

```

I would appreciate any guidance.

Answer: 
If you use the [Uri](http://msdn.microsoft.com/en-us/library/system.uri.aspx) class it provides a [Segments](http://msdn.microsoft.com/en-us/library/system.uri.segments.aspx) property which gives you the components of the path as a String array
Use [System.Uri](http://msdn.microsoft.com/en-us/library/system.uri.aspx) to split up the Uri. Then you could use [String.Split](http://msdn.microsoft.com/en-us/library/system.string.split.aspx) on the path.