Sitecore 5.0 API

MainUtil.GetWord Method 

Gets n'th word from a string.

[Visual Basic]
Public Shared Function GetWord( _
   ByVal text As String, _
   ByVal index As Integer, _
   ParamArray separators As Char() _
) As String
[C#]
public static string GetWord(
   string text,
   int index,
   params char[] separators
);

Parameters

text
A string.
index
A index.
separators
Seperators.

Return Value

The word ar the n'th position.

Remarks

The first word has index zero (0).

Example

 string myWord = MainUtil.GetWord("Welcome to my world", 2, ' '); // "my"

See Also

MainUtil Class | Sitecore Namespace