Results 1 to 3 of 3
  1. #1
    jtzako is offline Member
    Join Date
    Aug 2012
    Rep Power

    Question 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.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Rep Power

    Default 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.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default 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.

    ** This space for rent **

Similar Threads

  1. Replies: 6
    Last Post: 10-11-2011, 09:48 PM
  2. populating a list box based on another without refreshing the page
    By zahir in forum JavaServer Pages (JSP) and JSTL
    Replies: 8
    Last Post: 07-25-2011, 01:09 PM
  3. GUI text display input to list array
    By berndog in forum New To Java
    Replies: 1
    Last Post: 08-08-2010, 06:35 PM
  4. HELP!!! Problems with Array: matching, sorting, etc
    By jrelvi23 in forum New To Java
    Replies: 15
    Last Post: 11-18-2009, 11:14 PM

Posting Permissions

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