Results 1 to 3 of 3
- 08-30-2012, 11:06 PM #1
Member
- Join Date
- Aug 2012
- Posts
- 1
- Rep Power
- 0
Text matching based on a list/array ?
I'm currently using an excel sheet to do something I'd really rather do on my website. I'm wondering if this can be done in Java perhaps?
I need to be able to paste in a block of text (to a text area field perhaps) and have that text compared to a list of items. I want to have it output the original text but highlight the parts that match something in the list.
I suspect I can use an array for the list but I have no idea how to get it to search for, and highlight the text.
- 08-31-2012, 04:22 AM #2
Re: Text matching based on a list/array ?
The String class has several methods you can use to help you search. The methods: contains, indexOf, substring and length come to mind.
- 08-31-2012, 09:47 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,460
- Rep Power
- 16
Re: Text matching based on a list/array ?
Highlight where?
Are we talking in HTML?
In which case String has a replaceAll() method ... which you would know if you had looked at the API, and that's a skill you really need to pick up.
Replace the String with itself wrapped in whatever mark up is needed to priduce a highlight...and that's HTML, so not really relevant to here.Please do not ask for code as refusal often offends.
Similar Threads
-
How to delete files, based on a matching pattern in the filename in a directory.
By renu in forum New To JavaReplies: 6Last Post: 10-11-2011, 09:48 PM -
populating a list box based on another without refreshing the page
By zahir in forum JavaServer Pages (JSP) and JSTLReplies: 8Last Post: 07-25-2011, 01:09 PM -
GUI text display input to list array
By berndog in forum New To JavaReplies: 1Last Post: 08-08-2010, 06:35 PM -
HELP!!! Problems with Array: matching, sorting, etc
By jrelvi23 in forum New To JavaReplies: 15Last Post: 11-18-2009, 11:14 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks