while I > 0 do
begin
MyString[I] := AnsiUpperCase(MyString[I]);
I := I - 1;
end;
end;
Be careful indexing strings in this way, since overwriting the end of a string can cause access violations. Also, avoid
passing long-string
indexes as var parameters, because this results in inefficient code.
You can assign the value of a string constant - or any other expression that returns a string - to a variable. The length
of the string changes dynamically when the assignment is made. Examples:
MyString := 'Hello world!';
MyString := 'Hello' + 'world';
MyString := MyString + '!';
MyString := ' '; { space }
MyString := ''; { empty string }
Dostları ilə paylaş: