Print Page | Close Window

replace text by emoticons

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7987
Printed Date: 01 April 2026 at 1:00am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: replace text by emoticons
Posted By: zMaestro
Subject: replace text by emoticons
Date Posted: 10 December 2003 at 9:01am

I have a guest book reading from access database.
I want to replace every :) by <img src='Emoticons/01.gif'>
so :) be changed to  automatically...
and appears as a smile picture in the webpage.

what's the simplest way of doing so?

thanks.




Replies:
Posted By: Mart
Date Posted: 10 December 2003 at 9:19am
Replace(Request.Forum("message"), ":)", "<img src='Emoticons/01.gif'>")


Posted By: zMaestro
Date Posted: 10 December 2003 at 9:46am

after a very small modification.. it worked

bravo Mart, now you are 707 posts, 1 post more than pmormr .. and sure.. not a spam post



Posted By: Mart
Date Posted: 10 December 2003 at 9:49am
LOL


Posted By: zMaestro
Date Posted: 10 December 2003 at 4:08pm

It worked but....
what If I have more than 1 emoticon???

this is the code I use:

MSN = Replace(rMSN(2), ":)", "<img src=""GfX/Emoticons/01.gif"">")

it successfuly replace :) by the emoticons,
but what if there is :) and :( and :-/ and :-0 and ...etc
how can all these be replaced.

 



Posted By: michael
Date Posted: 10 December 2003 at 5:44pm
You will have to have a seperate Replace statement for all emoticons possible.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: fernan82
Date Posted: 10 December 2003 at 11:17pm
Or use an array like WWF does and just loop thru the array.

-------------
FeRnAN
http://www.danasoft.com/">


Posted By: zMaestro
Date Posted: 11 December 2003 at 2:30am

Quote You will have to have a seperate Replace statement for all emoticons possible.

I tried but It didn't work... something like MSN = Replace(rMSN(2), ":)", "<img src=""GfX/Emoticons/01.gif"">" & Replace(rMSN(2), ":(", "<img src=""GfX/Emoticons/02.gif"">")

it was repeated twice, I tried others but didn't work...
how can i make: replace (A by) B and (C by D) and (E by F) and (....)  in one statment...

come on.. you are the experts



Posted By: Mart
Date Posted: 11 December 2003 at 9:37am
Dim MSN
MSN = Replace(start-string, xxx, xxx)
MSN = Replace(MSN, xxx, xxx)
MSN = Replace(MSN, xxx, xxx)
MSN = Replace(MSN, xxx, xxx)
MSN = Replace(MSN, xxx, xxx)

Response.Write(MSN)



Posted By: pmormr
Date Posted: 11 December 2003 at 7:34pm
no fair... i couldn't log onto wwf for a few days because of a problem with the RTE...

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net