Thank you for your support!    
UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Edit Discussion
> GetMember    
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


Creative Commons License
GetMember by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
This page was last modified 09:35, 6 April 2011.  This page has been accessed 998 times.  Disclaimers