StringUtil.GetPrefix Method (String, Char, String)
Gets the prefix part of a string.
[Visual Basic]
Overloads Public Shared Function GetPrefix( _
ByVal
text As
String , _
ByVal
delimiter As
Char , _
ByVal
defaultValue As
String _
) As
String
Parameters
text
A string
delimiter
The character delimiting the prefix from the rest of the string.
defaultValue
Value to return if delimiter is not found in text
Return Value
All characters of the string up to the first occurrence of delimiter .
If delimiter is not found in the string, defaultValue is returned.
Example
string prefix = StringUtil.GetPrefix("sc:menu", ':');
MainUtil.Out(prefix);
Outputs:
sc
See Also
StringUtil Class | Sitecore Namespace | StringUtil.GetPrefix Overload List | Right | Mid