Is it possible to use "IsEmpty" methods in Delphi

Embaracdero documents "IsEmpty" methods for string types that I have successfully used with C ++ Builder code.

WideString s;

if (s.IsEmpty())
   ....

I tried the same from Delphi and could not compile it:

var s: WideString;
begin
  if s.IsEmpty then
  ....

I know that you can compare with an empty string or call the Length function, but is it possible to call this IsEmpty method from Delphi?

EDIT: just for clarification, this did not mean a problem with String vs Widestring.

Basically, the documents I refer to above describe the syntax of Pascal as well as C ++, but this does not seem to work. I assume this is just a flaw in the documentation.

Returns true if System :: WideString :: WideString is empty.

Pascal Function: IsEmpty: bool;

+5
5

String Delphi, , , Length, Copy .. String - ++, , , .

+14

. WideString, D2009. ; nil/empty string , .

Delphi:

var 
  s: string;
begin
  if s = '' then begin
    ShowMessage('It is empty or nil.');

... , ( = nil).

+5

Delphi - . . ( ) .

, . , . (), , (Integer).

, :

type
  TString = class
  private
    FString: string;
  public
    constructor Create(const AValue: string);

    property &String: string read FString write FString;
    property IsEmpty: Boolean read GetIsEmpty;
    // ...
  end;
+5
if Trim(s)='' then

???

+1
source

In new releases, you can use many helper functions and s.IsEmpty.

0
source

All Articles