开发者

First letter of a string to capital

Is there a syntax (like Uppercase(s)) in pascal to convert first letter of a st开发者_如何学Goring to an uppercase. First letter only.


Yes; you might use UpCase function (hope most of Pascal variants have it). Below is shown, how to use it for capitalizing first char in the given S string.

function UpCaseFirstChar(const S: string): string;
begin
  Result := S;

  if Length(Result) > 0 then
    Result[1] := UpCase(Result[1]);
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜