Logo

Programming-Idioms

  • PHP
  • C++
  • Python
  • Js

Idiom #320 Test if string is empty

Set b to true if the string s is empty, false otherwise

let b = !!s
b = s.empty();
b = s == ''
b = not s
#include <string.h>
bool b = !strlen(s);

C23 bool

New implementation...
< >
programming-idioms.org