357mag 2 Posted April 15, 2023 I was doing my empty string things wrong. I used to think that "" and " " meant the same thing. I just learned they don't. To make an empty string you do "" with the quotation marks close together. Where as the " " means the space character which has an ASCII code of 32. Does C++ Builder have a Clear() method like C# does? So if I didn't want to do this: labelAnswer.Text = "" I could use a Clear() method: labelAnswer.Clear() Something like that anyway. Share this post Link to post
Roger Cigol 103 Posted April 16, 2023 Documentation is useful for questions like this: https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.UnicodeString_Methods Share this post Link to post
357mag 2 Posted April 16, 2023 I did not see anything about a Clear method so I guess I would have to use Edit1 -> Text = "". Share this post Link to post
Fr0sT.Brutal 900 Posted April 17, 2023 There is EmptyStr constant, maybe it will help? I personally never bother of such things and always use '' / "" Share this post Link to post
Remy Lebeau 1394 Posted April 17, 2023 (edited) Quote Does C++ Builder have a Clear() method like C# does? Some UI controls do, and some do not. Quote So if I didn't want to do this: labelAnswer.Text = "" I could use a Clear() method: labelAnswer.Clear() A TLabel control does not have a Clear() method, in either VCL or FMX. Also, VCL's TLabel does not have a Text property, it has a Caption property instead: labelAnswer->Caption = ""; On the other hand, FMX's TLabel does have a Text property. On 4/16/2023 at 9:19 AM, 357mag said: I did not see anything about a Clear method so I guess I would have to use Edit1 -> Text = "". VCL's TEdit does have a Clear() method: Edit1->Clear(); FMX's TEdit, on the other hand, does not. However, it does have SelectAll() and DeleteSelection() methods instead: Edit1->SelectAll(); Edit1->DeleteSelection(); Edited April 17, 2023 by Remy Lebeau Share this post Link to post