Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!

Idiom #320 Test if string is empty

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

(def b (nil? s))
b = s.empty();
var b = string.IsNullOrEmpty(s);
final b = s.isEmpty;
b := s == ""
let b = !!s
boolean b = s.intern() == "";
boolean b = s.equals("");
b := (s = '');
use strict;
my $b = $s eq '';
b = not s
b = s == ''
b = s.empty?
b = s.is_empty()

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