Sitecore 5.1.1 API

MainUtil.SplitPath Method 

Splits a Sitecore path into parts, optionally expanding it to include the root.

[Visual Basic]
Public Shared Function SplitPath( _
   ByVal path As String, _
   ByVal expand As Boolean _
) As String()
[C#]
public static string[] SplitPath(
   string path,
   bool expand
);

Parameters

path
A Sitecore path.
expand
Indicates if the path should be expanded into including the root.

Return Value

An array of parts of the path.

Example

  string[] parts = MainUtil.SplitPath("/Home/Menu", false); // "Home", "Menu"
  string[] parts = MainUtil.SplitPath("/Home/Menu", true); // "sitecore", "content", "Home", "Menu"

See Also

MainUtil Class | Sitecore Namespace