Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use something like += in Delphi?

Tags:

delphi

I tried to search for this in google, but the += part is ignored.

So I want to add some text to a variable:

Text := 'asdf';
Text := Text + 'ghijk';

This works fine, but for longer variable names, something like this would be nice:

Text := 'asdf';
Text += 'ghijk';

How can I do this?

like image 785
András Avatar asked Apr 13 '14 16:04

András


1 Answers

There is no such operator available in the language.

For ordinal types you can use inc and dec but for all other types there is nothing.

For strings you can use TStringBuilder to append to a text buffer. Although you may well conclude that, in many cases, is more hassle than it is worth.

like image 95
David Heffernan Avatar answered Oct 15 '22 22:10

David Heffernan