Formatting Text

Results 1 to 2 of 2

Thread: Formatting Text

  1. #1
    Cindy Guest

    Default Formatting Text

    I have a FAQ site written in ASP. If a user enter a keyword to search, I display all the related resolutions from db and highlight the search keyword in red color.<BR>I use "Replace" function and it has been working fine except the it&#039s case-sensitive. For example, if a user enter "kodak", the word "Kodak" in the resolution is not highlighted.<BR>How do I make it non-case-sensitive? The following is the part of my code;<BR><BR>Function hikey(theString,keyword)<BR>hikey = Replace(theString,keyword,""&keyword&"") <BR>hikey = Replace(hikey,ucase(keyword),""&ucase(keyword)&"") <BR>End Function <BR><BR>&#060;html&#062;<BR>.........<BR>&#060;fon t class="bodytxtblck"&#062;<BR>&#060;%=hikey(rs("Res olution"),RequestString("keywords"))%&#062;&#060;/font&#062;<BR>......<BR>&#060;/html&#062;<BR><BR>Thanks in advance,<BR>

  2. #2 Guest

    Default RE: Formatting Text

    Ucase() both the string that will be searched and the string with which you are performing the serarch.<BR><BR>strContents = "This is a test"<BR>strSearch ="ThIs"<BR><BR>ucase(strContents) now = "THIS IS A TEST"<BR>ucase(strSearch) = "THIS"<BR><BR>now there is not reason why they should not match up. You might also use Trim on the strSearch to get rid of any spaces before or after the actual text.<BR><BR>Although I don&#039t think VBScript is case sensitive unless you use the "Select Case" function. This should solve the problem. <BR><BR>Good Luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts