feat(data-structures): add is_empty getter to map, string and blob.

This commit is contained in:
ltabis
2022-08-24 09:54:41 +02:00
parent 9c3443538a
commit 4b3608cedc
6 changed files with 41 additions and 3 deletions

View File

@@ -163,6 +163,11 @@ mod string_functions {
string.chars().count() as INT
}
}
/// Return true if the string is empty.
#[rhai_fn(name = "is_empty", get = "is_empty")]
pub fn is_empty(string: &str) -> bool {
string.len() == 0
}
/// Return the length of the string, in number of bytes used to store it in UTF-8 encoding.
///
/// # Example