I’d like to know how to embed an smiles in a message. Just like in this forum, I’ll just type
:)
and it will appear as :). Please give me an idea about this. Thank you so much.
I’d like to know how to embed an smiles in a message. Just like in this forum, I’ll just type
:)
and it will appear as :). Please give me an idea about this. Thank you so much.
use some string replacement functionality (regex or otherwise) for this, to replace for example
:)
with
<img src="/smileys/smile.gif" alt="Smile" />
One more hint, sort the smileys in order of the length of the characters to be typed before starting replacement, since some smileys contain a section of another smiley.
For example if I have a smiley like
o:)
which is supposed to be an angel or something, but I start with replacing
:)
with the image, I will get
o<img src="/smileys/smile.gif" alt="Smile" />
The o remains, the smiley is not correctly replaced because a “subset” of the smiley was replaced before looking for the complete smiley.
Sorting by length is key here