Я хочу создать текстовую функцию ProperCase, которая преобразует:
O'Shanesy, Ben'S and frank'S tires
в:
O'Shanesy, Ben's and Frank's tires
Как получить strReturn.Replace ("'S", "' s") работать только тогда, когда после символа s нет символа?
Public Function fProperCase(ByVal strTextIn As String, Optional ByVal bolIncludingAnd As Boolean = True) As String
Dim strReturn As String = strTextIn.Trim
strReturn = StrConv(strTextIn, VbStrConv.ProperCase)
If bolIncludingAnd = False Then
strReturn = strReturn.Replace("And", "and")
End If
'Change all 'S to 's unless there is
'another letter straight after
strReturn.Replace("'S", "'s")
Return strReturn
End Function