aboutsummaryrefslogtreecommitdiffhomepage
path: root/tdutils/td/utils/emoji.h
blob: deb2759d5bc46a00075b16531f5118ef62b36cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2026
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once

#include "td/utils/common.h"
#include "td/utils/Slice.h"

namespace td {

// checks whether the string is an emoji; variation selectors are ignored
bool is_emoji(Slice str);

// checks whether emoji ends on a Fitzpatrick modifier and returns its number or 0
int get_fitzpatrick_modifier(Slice emoji);

// removes all Fitzpatrick modifier from the end of the string
Slice remove_fitzpatrick_modifier(Slice emoji);

// removes all emoji modifiers from the string
string remove_emoji_modifiers(Slice emoji, bool remove_selectors = true);

// removes all emoji modifiers from the string in-place
void remove_emoji_modifiers_in_place(string &emoji, bool remove_selectors = true);

// removes all emoji selectors from the string if it is an emoji
string remove_emoji_selectors(Slice emoji);

}  // namespace td