开发者

First letter of a string to capital

开发者 https://www.devze.com 2023-03-08 14:00 出处:网络
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 h

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

精彩评论

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