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;
精彩评论