Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-01-2005, 12:18 AM   #1 (permalink)
fareez
Registered User
 
Join Date: Apr 2005
Posts: 2
fareez is on a distinguished road
Highlight the keyword in asp

Hi,
My problem is i need to search for a keywords in a given string(which is from database) if keywords matches with any part of the string then i need to highlight the word.Can any one help me in this.

Note:i write code in asp..

adv thnxs
fareez is offline   Reply With Quote
Old 04-04-2005, 10:03 AM   #2 (permalink)
Mazzman
Registered User
 
Join Date: Mar 2005
Posts: 7
Mazzman is on a distinguished road
you could use the following replace() vbscript function....

usage would be something like this

Replace(string_returned_for_db,string_you_are_look ing_for, "<b>" & string_you_are_looking_for & "</b>")

the result would bold the output if it was being viewed on the web.

------------ generic usage is----------------------------
Dim MyString
' A binary comparison starting at the beginning of the string.
'MyString = Replace("XXpXXPXXp", "p", "Y")
' Returns "XXYXXPXXY".
------------ generic usage is----------------------------

VBScript reference is at http://msdn.microsoft.com/library/de...ifunctions.asp



below are some of th specifics about the replace function from the page


__________________________________________________ ____________

Replace(expression, find, replacewith[, start[, count[, compare]]])



Arguments

expression
Required. String expression containing substring to replace.
find
Required. Substring being searched for.
replacewith
Required. Replacement substring.
start
Optional. Position within expression where substring search is to begin. If omitted, 1 is assumed. Must be used in conjunction with count.
count
Optional. Number of substring substitutions to perform. If omitted, the default value is -1, which means make all possible substitutions. Must be used in conjunction with start.
compare
Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values. If omitted, the default value is 0, which means perform a binary comparison.
Mazzman is offline   Reply With Quote
Old 04-04-2005, 11:06 PM   #3 (permalink)
fareez
Registered User
 
Join Date: Apr 2005
Posts: 2
fareez is on a distinguished road
Yeah thnxs man.....But this is for single keyword but if i have a multiple keywords to be searched in an given string then how can i slove this...
Like exp:ASp,ASp.net iam searching in a string if my string contains asp and also asp.net then how it will be highlighted.....Pl do help me...
fareez is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Tutorials: ASP Strings, and Visual Studio/VB.NET sde Code Newbie News 0 03-25-2004 06:37 PM
New Java and ASP Tutorials sde Code Newbie News 2 03-15-2004 08:02 PM
Php Vs. Asp sde PHP 6 06-06-2003 06:02 PM


All times are GMT -8. The time now is 10:29 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting