Empty string: Difference between revisions
Content added Content deleted
(add Zig example) |
|||
Line 1,308: | Line 1,308: | ||
=={{header|FutureBasic}}== |
=={{header|FutureBasic}}== |
||
<lang futurebasic>window 1, @"Empty string", (0,0,480,270) |
|||
FB has several ways to determine string length as demonstrated below. |
|||
Note: The length -- or number of characters -- of a Pascal string in FB is stored in the first element of the string array. Here the string is dimensioned a s, hence s[0] contains the length of the string, and any individual character in the string can be found using s[i], where i is the position of the character. This makes iterating over the individual characters in a string easier than using functions such as instr or mid$. |
|||
<lang futurebasic> |
|||
include "ConsoleWindow" |
|||
CFStringRef s |
|||
dim as Str255 s |
|||
s = "" |
s = @"" |
||
if |
if ( fn StringIsEqual( s, @"" ) ) then print @"string is empty" |
||
if s |
if ( fn StringLength( s ) == 0 ) then print @"string is empty" |
||
if len(s) == 0 then print " |
if ( len(s) == 0 ) then print @"string is empty" |
||
print |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
if |
if ( fn StringIsEqual( s, @"" ) == NO ) then print @"string not empty" |
||
⚫ | |||
</lang> |
|||
⚫ | |||
HandleEvents</lang> |
|||
=={{header|Gambas}}== |
=={{header|Gambas}}== |