含有英文字母與中文的字串,如何轉大寫呢?

hotswin 2009-11-23 12:46:30
例如:
str:='你好 bill';
想要把它轉成 "你好 BILL"
請問要怎麼做呢?
...全文
50 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
dinoalex 2009-11-23
  • 打赏
  • 举报
回复
[Code=Delphi(Pascal)]
procedure TForm1.Button1Click(Sender: TObject);
var
s: string;
i: integer;
begin
s:= '1你a好! A 2hello3 wORlD,please 结 帖 !!!';
for i:= 1 to length(s) do
if (ByteType(s[i],1) = mbSingleByte) then s[i]:= upcase(s[i]);
showmessage(s);
end;
[/Code]

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧