Sitecore 5.0 API

MainUtil.Split Method (String, Char, Boolean)

Splits a string into an array of strings.

[Visual Basic]
Overloads Public Shared Function Split( _
   ByVal s As String, _
   ByVal separator As Char, _
   ByVal trim As Boolean _
) As String()
[C#]
public static string[] Split(
   string s,
   char separator,
   bool trim
);

Parameters

s
A string.
separator
A seperator.
trim
If true, individual parts of the split will be trimmed.

Return Value

An array of strings.

Remarks

Blank strings are excluded from the array.

Example

  string[] strings = MainUtil.Split("Name1|Value1|Name2||Name3|Value3", '|');
  // "Name1", "Value1", "Name2", "Name3", "Value3"
Please notice that Value2 is missing.

See Also

MainUtil Class | Sitecore Namespace | MainUtil.Split Overload List