Replace text with picture!

General TRichView support forum. Please post your questions here
Post Reply
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Replace text with picture!

Post 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
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply