[thelist] ASP - Highlighting words in a string

Chris Nimmo chris.nimmo at stl.org
Tue Nov 11 06:44:25 CST 2003


Heyhey,

I'm not an expert with ASP but earlier today I was trying to make a script that would grab the first (x) words from a string and emphasise them. I almost turned to theList for help but eventually got it working. 

<%
Dim msg1, counter, numwords

msg1 = "one two three four five six seven eight nine ten"
numwords = 4 

for counter = 1 to numwords
                    
  msgbegin = msgbegin & Left(msg1, InStr(msg1, " ")) 
  msg1 = Mid(msg1,InStr(msg1, " ")+1,Len(msg1))

next

Response.Write("<b>" & msgbegin & "</b>" & msg1)
%>

Chris

_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com .


More information about the thelist mailing list