How to iterate through various emojis

is it possible to iterate through different emojis like we iterate through character

Do you want to find all emojis in a string, or list all emojis?

list all emojis

The code points of emoji are not just an increasing sequence of numbers - some even consist of several code points. The easiest would probably be to find a list somewhere and include it using include_str. You can then iterate through the list using the ordinary string iteration methods.

1 Like

The rust-unic project has a list of emoji characters you may be able to use.

Otherwise you may want to check out BurntSushi's ucd-generate tool.

1 Like

I am not sure I am getting the question right, but is this what you are looking for?

fn main() {
   let str_of_emojis = "😘🤗🦀";

   for emoji in str_of_emojis.chars() {
       println!("{}", emoji);

So, in the end, it is the same as iterating over any other unicode character.