If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > I have records where I need to replace one letter with another.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-05, 21:00
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
I have records where I need to replace one letter with another.

I have records where I need to replace one letter with another. Can I modify this highlighting code to do that?

What I need to do is to update my table of database where a column has to replace one letter with another.

WHat I have is the "insert into" statement where I duplicated the table (not shown below).

I need your advice on this.

Code:
<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
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)
    Loop
  End If
End Function
</SCRIPT>
<%
'OPTION EXPLICIT
Dim strText, strFind
strFind=Keyword
strText=RS("new_text_data")
strText= Highlight(strText, strFind,"<font color='red'><b>", "</b></font>")
Response.Write strText
%>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On