Proper Case with a twist?

# Thread: Proper Case with a twist?

1. Junior Member
Join Date
Dec 1969
Posts
29

## Proper Case with a twist?

Hi All,<BR><BR>I found the simple function below which changes the input to "Proper Case". However, I would like something that would also properly handle names. Such as changing MC&#039;KINERY to Mc&#039;Kinery but at the same time not changing plurals such as MC&#039;KINERY&#039;S to Mc&#039;Kinery&#039;s.<BR><BR>I would like to use it to manipulate Names, adrresses etc.. for storage purposes.<BR><BR>Could someone tell me if they know of such a function? In the alternative would you suggest for me to start from scratch or start using the function below and then alter it. Or Am I just being to ambitious?<BR><BR>Any Help would be appreciated. Thanks,<BR><BR>JB<BR><BR>HERE IS THE CODE...........................<BR><BR>Function PCase(strInput)<BR> Dim iPosition<BR> Dim iSpace<BR> Dim strOutput<BR> <BR> iPosition = 1<BR><BR> Do While InStr(iPosition, strInput, " ", 1) &#060;&#062; 0<BR> iSpace = InStr(iPosition, strInput, " ", 1)<BR> strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))<BR> strOutput = strOutput & LCase(Mid(strInput, iPosition + 1, iSpace - iPosition))<BR> iPosition = iSpace + 1<BR> Loop<BR><BR> strOutput = strOutput & UCase(Mid(strInput, iPosition, 1))<BR> strOutput = strOutput & LCase(Mid(strInput, iPosition + 1))<BR><BR>PCase = strOutput<BR><BR>End Function<BR> <BR>

2. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: Proper Case with a twist?

First check if the last two charachters are &#039;s<BR><BR>Function Pcase(strInput)<BR>If Not Right(Trim(StrInput)) = "&#039;S" Then<BR> Strings = Split(strInput, "&#039;")<BR> For x = 0 To UBound(Strings)<BR> Pc = Pc & UCase(left(Strings(x), 1) & "&#039;" & LCASE(Mid(Strings, 2)<BR> next<BR>PCase = Mid(Pc, 1, len(Pc) -1)<BR>Else<BR>PCase = strInput<BR>End function

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•