开发者

Pascal comparing strings

开发者 https://www.devze.com 2023-02-22 02:59 出处:网络
I n开发者_JAVA技巧eed to see if one string is not the same AS EMPTY STRING. Something like: string != \'\';

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');
0

精彩评论

暂无评论...
验证码 换一张
取 消