Page 1 of 1

Replace text with picture!

Posted: Sun Oct 05, 2014 3:27 pm
by mohsen24000
Hi Dear Admin :)
Please guide me which way is better for replacing emoticons characters with it's picture:
1- parsing character by character and compare with emoticons code!
my emoticons are over 800 code.
or
2- find emoticons character in a loop for all codes and replace it with it's picture!

thanks a lot

Posted: Sun Oct 05, 2014 5:06 pm
by Sergey Tkachenko
I suggest parsing text and searching for empoticons code.
A basic code can be taken from http://www.trichview.com/forums/viewtopic.php?t=63 , but, for 800 emoticons, EmoticonAtIndex function must be implemented more efficiently.

For example, you can have array of sorted string lists, SL[N] contains codes of length N.
When searching for emoticons, you search in SL[2], then SL[3], etc. Use SL[N].Find, it's very efficient, because it implements binary search.