|
|
ФИО полностью по Имени, Фамилии и Отчеству с нормализацией строки
Public Function GetFIO(vFamilia As Variant, vImja As Variant, vOtchestvo As Variant, _
Optional bInLongFormat As Boolean) As Variant
Dim iLen%, sTemp$
On Error GoTo GetFIO_Err
If IsNull(vFamilia) = False Then
iLen = InStr(vFamilia, "-")
If iLen = 0 Then
GetFIO = UCase(Mid(vFamilia, 1, 1)) & Mid(vFamilia, 2)
Else
sTemp = Mid(vFamilia, 1, iLen - 1)
sTemp = Trim(sTemp)
sTemp = StrConv(sTemp, 3)
GetFIO = sTemp
sTemp = Mid(vFamilia, iLen + 1)
sTemp = Trim(sTemp)
sTemp = StrConv(sTemp, 3)
GetFIO = GetFIO & "-" & sTemp
End If
Else
GetFIO = "!Фамилия!"
End If
If IsNull(vImja) = False Then
If bInLongFormat = False Then
GetFIO = GetFIO & " " & UCase(Mid(vImja, 1, 1)) & "."
Else
GetFIO = GetFIO & " " & StrConv(vImja, 3)
End If
Else
If bInLongFormat = False Then
GetFIO = GetFIO & " " & "!Имя!."
End If
End If
If IsNull(vOtchestvo) = False Then
If bInLongFormat = False Then
GetFIO = GetFIO & UCase(Mid(vOtchestvo, 1, 1)) & "."
Else
GetFIO = GetFIO & " " & StrConv(vOtchestvo, 3)
End If
End If
GetFIO_Bye:
Exit Function
GetFIO_Err:
Err.Clear
Resume GetFIO_Bye
End Function
|
|