Delphi 首字母转换大写


本文整理自网络,侵删。

 
function TitleCase(const s : string) : string; 
var 
   i : integer; 
begin 
   if s = '' then 
     Result := '' 
   else begin 
     Result := Uppercase(s[1]); 
     for i := 2 to Length(s) do 
       if s[i - 1] = ' ' then 
         Result := Result + Uppercase(s[i]) 
       else 
         Result := Result + Lowercase(s[i]); 
   end; 
end; 
As in: 
procedure TForm1.Button1Click(Sender: TObject); 
begin 
   Edit1.Text := TitleCase('the quick brown fox jumped over the lazy dog'); 
end; 

相关阅读 >>

Delphi tstylemanager读取vsf皮肤文件信息

Delphi winapi: getactivewindow - 获取当前活动窗口的句柄

dephi获取系统常量

Delphi ioutils单元查找文件夹高级功能

Delphi 精确打印image画布

Delphi 取字符串中间

Delphi winsock downloader

Delphi文件捆绑器

Delphi txt 指定行复制器

Delphi xe8在firemonkey tlistbox中显示图像

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...