Change String To Proper Case
I may be reinventing the wheel here, but so far I have yet to find a built in Delphi function that will convert a string to proper case. I found this code somewhere on the web a while back, lost it, and managed to recreate it last night.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
<p> <font face="Verdana" size="2"> <b>NOTE:</b>Make sure to add "StrUtils" to your Uses section</p> <p> <font color="#008000"> function properCase(sBuffer: string):string; <br> var<br> iLen, iIndex: integer;<br> begin<br> iLen := Length(sBuffer);<br> sBuffer:= Uppercase(MidStr(sBuffer, 1, 1)) + Lowercase(MidStr(sBuffer,2, iLen));<br><br> for iIndex := 0 to iLen do<br> begin<br> if MidStr(sBuffer, iIndex, 1) = ' ' then<br> sBuffer := MidStr(sBuffer, 0, iIndex) + Uppercase(MidStr(sBuffer, iIndex + 1, 1)) + Lowercase(MidStr(sBuffer, iIndex + 2, iLen));<br> end;<br><br> Result := sBuffer;<br><br> end;<br> </font></font></p>
Original Comments (3)
Recovered from Wayback Machine