123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Highlight Word Function

--------------------------------------------------------------------------------

Description : Search for occurances of a keyword in a string and highlight them, by either bold, italic or boli-italic

<%
' YOU CAN CALL THE FUNCTION IN THE FOLLO
' WING WAYS
mys = "This is a test To find the word you, it will highlight your, "
w2f = "you"
Response.Write doHighlight(mys, w2f, "bi")
Response.Write "<BR>"
Response.Write doHighlight("This is a test To find the word you, it will highlight your...", "you", "bi")
%>
<%
Function doHighlight(my_sentence, word_to_highlight, my_fn)
' doHighlight Function
' Description: Search for occurances of
' a keyword in a string and highlight them
' , by either bold, italic or boli-italic
' Inputs: String you want searched, word
' to highlight, and the type of highlight
' to perform.
' Types of highlight functions: b=bold;
' i=italic; bi=bold-italic
' Output: Returns the string with highli
' ghting.
Select Case LCase(my_fn)
Case "b"
my_output = "<B>" & word_to_highlight & "</B>"
doHighlight = Replace(my_sentence, word_to_highlight, my_output)

Case "i"
my_output = "<I>" & word_to_highlight & "</I>"
doHighlight = Replace(my_sentence, word_to_highlight, my_output)
Case "bi"
my_output = "<I><B>" & word_to_highlight & "</B></I>"
doHighlight = Replace(my_sentence, word_to_highlight, my_output)
End Select
End Function
%>

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG