Empty string: Difference between revisions
Content added Content deleted
(HolyC) |
|||
Line 727: | Line 727: | ||
when (null s) (putStrLn "Empty.") |
when (null s) (putStrLn "Empty.") |
||
when (not $ null s) (putStrLn "Not empty.")</lang> |
when (not $ null s) (putStrLn "Not empty.")</lang> |
||
=={{header|HolyC}}== |
|||
<lang holyc>/* assign an empty string */ |
|||
U8 *str = StrNew(""); |
|||
/* or */ |
|||
U8 *str = ""; |
|||
/* to test if string is empty */ |
|||
if (StrLen(str) == 0) { ... } |
|||
/* or compare to a known empty string. "== 0" means strings are equal */ |
|||
if (StrCmp(str, "") == 0) { ... } |
|||
/* to test if string is not empty */ |
|||
if (StrLen(str)) { ... }</lang> |
|||
=={{header|I}}== |
=={{header|I}}== |