'Pascal comparing strings
I need to see if one string is not the same AS EMPTY STRING. Something like: string != ''; How can I achieve it in Pascal?
Solution 1:[1]
The inequality operator is '<>', string <> '';.
Solution 2:[2]
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');
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sertac Akyuz |
| Solution 2 |
