Code:
Public Function FinalStr() As String
    Dim a As String
    Dim b As String
    a = "TFSGNT-SAH-CMP-PreMeas"
    b = "ILD-SAH-CMP-Meas-5P25K"
    
    Dim ar
    Dim br
    Dim intcnt As Integer
    Dim firstStr As String
    Dim secondStr As String
    
    ar = Split(a, "-")
    If UBound(ar) = 3 Then
        firstStr
...