我有一個這樣的數據庫表情列表檢查字符並將圖釋轉換爲文本? C#
id | emoticon | convert_text
1 | :) | e_happy
2 | :( | e_sad
等
如何檢查是否有任何字符列入表情符號列表?
如果找到,則將表情符號改爲文字。
例子:
before
S = Smile at everyone who doesn't smile at your :)
after
S= Smile at everyone who doesn't smile at your e_happy
*編輯
首先我試過每一個字拆這樣
static void Main(string[] args)
{
string value = "Smile at everyone who doesn't smile at your :)";
char[] delimiter = new char[] { ' ', ',', '.' };
string[] array = value.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
foreach (string entry in array)
{
Console.WriteLine(entry);
}
Console.ReadKey();
}
我很困惑如何檢查每個字進行的表情列表在數據庫中,並將圖釋轉換爲文本,如示例 *對不起,這是我的第一篇文章,我正在翻譯谷歌翻譯
我已經更新我的問題 – Hibishi
因此,第一部分是從數據庫中獲取表情圖到相應的convert_text標記。這取決於你正在使用的數據庫。你已經完成了這部分? –
您可以將'emoticon'和'convert_text'存儲到'Dictionary'中,其中鍵是'表情符號'是關鍵字,'convert_text'是值。然後使用字典查找並替換單詞。 一旦你遇到問題,你會分裂字符可能會丟失,你可能需要找出一個辦法 –
Ramesh