Pascal comparing strings
I n开发者_JAVA技巧eed to see if one string is not the same AS EMPTY STRING. Something like: string != ''; How can I achieve it in Pascal?
The inequality operator is '<>', string <> '';
.
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');
精彩评论