Public Function DaoTu(Cll)
Dim Tach, TachA, Gom, I, J, Dau, Giua, Cuoi, iDau, iGiua, A, Kq
If InStr(Cll, Chr(10)) Then
TachA = Split(Cll, Chr(10))
For J = LBound(TachA) To UBound(TachA)
If Right(TachA(J), 1) = "." Then
A = Replace("." & TachA(J), ". ", ". .")
Else
A = Replace("." & TachA(J) & ".", ". ", ". .")
End If
Tach = Split(A)
For I = UBound(Tach) To LBound(Tach) Step -1
Dau = Left(Tach(I), 1): Giua = Mid(Tach(I), 2, Len(Tach(I)) - 2): Cuoi = Right(Tach(I), 1)
If Dau = "." And Cuoi = "." Then
iDau = Left(Giua, 1): iGiua = Right(Giua, Len(Giua) - 1)
Gom = Gom & UCase(iDau) & iGiua & ". "
ElseIf Dau = "." Then
iDau = Left(Giua, 1): iGiua = Right(Giua, Len(Giua) - 1)
Gom = Gom & LCase(iDau) & iGiua & Cuoi & ". "
ElseIf Cuoi = "." Then
Gom = Gom & UCase(Dau) & Giua & " "
Else
Gom = Gom & Dau & Giua & Cuoi & " "
End If
Next I
Kq = Kq & Gom & Chr(10)
Gom = ""
Next J
Else
If Right(Cll, 1) = "." Then
A = Replace("." & Cll, ". ", ". .")
Else
A = Replace("." & Cll & ".", ". ", ". .")
End If
Tach = Split(A)
For I = UBound(Tach) To LBound(Tach) Step -1
Dau = Left(Tach(I), 1): Giua = Mid(Tach(I), 2, Len(Tach(I)) - 2): Cuoi = Right(Tach(I), 1)
If Dau = "." And Cuoi = "." Then
iDau = Left(Giua, 1): iGiua = Right(Giua, Len(Giua) - 1)
Gom = Gom & UCase(iDau) & iGiua & ". "
ElseIf Dau = "." Then
iDau = Left(Giua, 1): iGiua = Right(Giua, Len(Giua) - 1)
Gom = Gom & LCase(iDau) & iGiua & Cuoi & ". "
ElseIf Cuoi = "." Then
Gom = Gom & UCase(Dau) & Giua & " "
Else
Gom = Gom & Dau & Giua & Cuoi & " "
End If
Next I
Kq = Gom
End If
DaoTu = Kq
End Function