| Вот откопал у себя.....работает не совсем корректно из-за окончаний мужских отчеств...вообщем окончания оглы оол и т.д воспринимает за женщин ...ну и склоняет соответственно (код всего для одного падежа) где раскопал не помню, но не мое точно
Function GenitiveCase(sSurname As String, sName As String, sPatronymic As String) As String
Dim bMaleSex As Variant
bMaleSex = (Right(sPatronymic, 1) = "ч")
' Фамилия
If Len(sSurname) > 0 Then
If bMaleSex Then
Select Case Right(sSurname, 1)
Case "о", "и", "я", "а", "х"
GenitiveCase = sSurname
Case "й"
GenitiveCase = Mid(sSurname, 1, Len(sSurname) - 2) + "ого"
Case Else
GenitiveCase = sSurname + "а"
End Select
Else
Select Case Right(sSurname, 1)
Case "о", "и", "б", "в", "г", "д", "ж", "з", "к", "л", "м", "н", "п", "р", "с", "т", "ф", "х", "ц", "ч", "ш", "щ", "ь"
GenitiveCase = sSurname
Case "я"
GenitiveCase = Mid(sSurname, 1, Len(sSurname) - 2) & "ой"
Case Else
GenitiveCase = Mid(sSurname, 1, Len(sSurname) - 1) & "ой"
End Select
End If
GenitiveCase = GenitiveCase & " "
End If
' Имя
If Len(sName) > 0 Then
If bMaleSex Then
Select Case Right(sName, 1)
Case "й", "ь"
GenitiveCase = GenitiveCase & Mid(sName, 1, Len(sName) - 1) & "я"
Case Else
GenitiveCase = GenitiveCase & sName & "а"
End Select
Else
Select Case Right(sName, 1)
Case "а"
Select Case Mid(sName, Len(sName) - 1, 1)
Case "и", "г"
GenitiveCase = GenitiveCase & Mid(sName, 1, Len(sName) - 1) & "и"
Case Else
GenitiveCase = GenitiveCase & Mid(sName, 1, Len(sName) - 1) & "ы"
End Select
Case "я"
If Mid(sName, Len(sName) - 1, 1) = "и" Then
GenitiveCase = GenitiveCase & Mid(sName, 1, Len(sName) - 1) & "и"
Else
GenitiveCase = GenitiveCase & Mid(sName, 1, Len(sName) - 1) & "и"
End If
Case "ь"
GenitiveCase = GenitiveCase & Mid(sName, 1, Len(sName) - 1) & "и"
Case Else
GenitiveCase = GenitiveCase & sName
End Select
End If
GenitiveCase = GenitiveCase & " "
End If
' Отчество
If Len(sPatronymic) > 0 Then
If bMaleSex Then
GenitiveCase = GenitiveCase & sPatronymic & "а"
Else
GenitiveCase = GenitiveCase & Mid(sPatronymic, 1, Len(sPatronymic) - 1) & "ы"
End If
End If
End Function | |