Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pascal comparing strings

Tags:

string

pascal

I need to see if one string is not the same AS EMPTY STRING. Something like: string != ''; How can I achieve it in Pascal?

like image 385
dada Avatar asked Oct 29 '25 08:10

dada


2 Answers

The inequality operator is '<>', string <> '';.

like image 125
Sertac Akyuz Avatar answered Oct 31 '25 02:10

Sertac Akyuz


You can use the Length function, which will return the string length.

s:='My string';
x:=Length(s);
if( x > 1 ) then writeln('The string is not empty') 
            else writeln('The string is empty');
like image 22
Sergiu Avatar answered Oct 31 '25 01:10

Sergiu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!