Logo

Programming-Idioms

History of Idiom 110 > diff from v56 to v57

Edit summary for version 57 by programming-idioms.org:
[Rust] +DemoURL

Version 56

2020-11-26, 12:26:28

Version 57

2020-12-09, 14:42:56

Idiom #110 Check if string is blank

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

Idiom #110 Check if string is blank

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

Code
let blank = s.trim().is_empty();
Code
let blank = s.trim().is_empty();
Doc URL
https://doc.rust-lang.org/std/string/struct.String.html#method.trim
Doc URL
https://doc.rust-lang.org/std/string/struct.String.html#method.trim
Demo URL
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=ae6ae85f425a04b915fdef1ca0054866