|
|
CODE ' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary ' Original submission by Walter Niesz ' August 4, 2010 ' ' DESCRIPTION ' Many times it is necessary to retrieve a component of some delimited string of characters. ' This function allows you to specify the delimiter, as well as the position it resides in. ' If no member is found at that position, Null is returned. ' The default delimiter is a comma (,) ' The default position is 1 Public Function GetMember(Domain As String, Optional Position As Long = 1, Optional Delimiter As String = ",") As Variant Dim MyArray 'no string passed; exit If Domain = "" Then Exit Function MyArray = Split(Domain, Delimiter) 'domain does not contain entry at given position; exit If LBound(MyArray) > Position - 1 Or UBound(MyArray) < Position - 1 Then Exit Function GetMember = MyArray(Position - 1) End Function
|
| This page was last modified 09:35, 6 April 2011. This page has been accessed 998 times. Disclaimers |