Access/VBA Library

GetSectionFromIndex

Private function which returns a String containing the name of the section. This is the value before the first dot in index.

When no section is specified, the default section ('config') is returned.

Syntax

GetSectionFromIndex( index )
Parameters
Name Type Description
index String Required. Pair of section and key, separated by a dot.
Return value

String : Name of the section.

Code
Private Function GetSectionFromIndex(index As String) As String

    Dim pos As Integer
    
    pos = InStr(index, ".")
    If pos = 0 Then
        GetSectionFromIndex = cDefaultSection
    Else
        GetSectionFromIndex = Left$(index, pos - 1)
    End If
    
End Function