Wrox Programmer Forums
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 1st, 2005, 01:46 PM
Friend of Wrox
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default Highlight keyword's array

I need to highlight the array of the "keyword".

Function Highlight(strText, strFind, strBefore, strAfter)
  Dim nPos
  Dim nLen
  Dim nLenAll

  nLen = Len(strFind)
  nLenAll = nLen + Len(strBefore) + Len(strAfter) + 1

  Highlight = strText

  If nLen > 0 And Len(Highlight) > 0 Then
    nPos = InStr(1, Highlight, strFind, 1)
    Do While nPos > 0
      Highlight = Left(Highlight, nPos - 1) & _
        strBefore & Mid(Highlight, nPos, nLen) & strAfter &_
         Mid(Highlight, nPos + nLen)

      nPos = InStr(nPos + nLenAll, Highlight, strFind, 1)
  End If
End Function
Dim strText, strFind

strText= Highlight(strText, strFind,"<b>", "</b>")

Response.Write strText
Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to highlight changes SoberGuy Word VBA 2 October 24th, 2008 11:46 AM
How to highlight in Excel haiying Excel VBA 5 April 6th, 2005 01:29 PM
how to highlight in Powerpoint haiying Access VBA 6 April 6th, 2005 08:04 AM
Highlight record JpJoe Access 4 January 28th, 2005 09:58 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.