Logo

Programming-Idioms

History of Idiom 110 > diff from v106 to v107

Edit summary for version 107 by ferdinandor:
New Lua implementation by user [ferdinandor]

Version 106

2023-02-01, 10:11:27

Version 107

2023-02-27, 21:32:27

Idiom #110 Check if string is blank

Set the boolean blank to true if the string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set the boolean blank to true if the string s is empty, or null, or contains only whitespace ; false otherwise.

Code
 blank = (s == nil or #string.gsub(s, "^%s*(.-)%s*$", "%1") == 0)