I am inserting smileys into strings. I have encoded the smileys in a certain format and when before I display the string in a component I need to replace all occurrences of the smiley codes with HTML img tags so they will show up as images. So here is the format of my smileys –
&:) ==> smile
&:O ==> shocked
&:( ==> sad
etc...
So say I have the following string –
Did you hear the news &:O. I won a million dollars!! &:)
I need to find, and then replace all the smiley codes with HTML like
<img src='file:C:/images/sad.png'/>
define this somewhere:
then fill it with the smileys (String) and their html representation:
replacing smileys is done by replacing every occurrence of a smiley code by its html representation, just loop the hashmap like this: