Dim AtSignLocation As LongDim i As LongDim TempStr As StringConst CharList As String = "[A-Za-z0-9._-]" 'Get location of the @AtSignLocation = InStr(s, "@")If AtSignLocation = 0 ThenExtractEmailAddress = "" 'not foundElseTempStr = "" 'Get 1st half of email addressFor i = AtSignLocation - 1 To 1 Step -1 If Mid(s, i, 1) Like CharList ThenTempStr = Mid(s, i, 1) & TempStr Else ExitForEnd IfNext iIf TempStr = "" Then Exit Function 'get 2nd half TempStr = TempStr & "@"For i = AtSignLocation + 1 To Len(s) If Mid(s, i, 1) Like CharList ThenTempStr = TempStr & Mid(s, i, 1)ElseExit For End IfNext i End If 'Remove trailing period if it exists If Right(TempStr, 1) = "." ThenTempStr = _ Left(TempStr, Len(TempStr) - 1)ExtractEmailAddress = TempStr
End Function
Veja outros códigos:
Série DONUT PROJECT 2021
Série DONUT PROJECT 2018
Série DONUT PROJECT 2015
Série DONUT PROJECT 2014
Clique aqui e nos contate via What's App para avaliarmos seus projetos
Envie seus comentários e sugestões e compartilhe este artigo!
brazilsalesforceeffectiveness@gmail.com