Results 1 to 2 of 2
  1. #1
    DeCoolJB is offline Member
    Join Date
    Oct 2011
    Rep Power

    Default string replaceall occurences with strings inside arrays

    Let our string be a sentence that contains several unique terms, such as

    "person1: hello, person2! person3, are you the same person as person4?"

    I would like to replace person1, person2, person 3, and person4 with strings I have in a text file. In the text file, this would be an example of what it looks like:


    NOTICE how person3 and person4 have the same replacer term - also, I have a bufferedreader that puts the entire text file into an array, lets name it "example".

    How would I have it so that the text gets ALL the elements of array "example" so it can replace the prefix of "=" by the
    suffix of "=". So, the final string would look like:

    "example1: hello, example2! example3, are you the same as example3?"

    Also, note that the size of array "example" is indefinite, as you can add even more lines to the text file.

  2. #2
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Melbourne, Victoria, Australia
    Rep Power

    Default Re: string replaceall occurences with strings inside arrays

    Read these two recplace() functions: String (Java 2 Platform SE v1.4.2)

Similar Threads

  1. Replies: 2
    Last Post: 07-21-2011, 03:46 AM
  2. Replies: 2
    Last Post: 04-25-2011, 04:13 PM
  3. Regular Expressions and String.replaceAll()
    By meta1203 in forum New To Java
    Replies: 1
    Last Post: 11-24-2010, 11:41 PM
  4. Replies: 8
    Last Post: 10-08-2010, 07:24 AM
  5. How to count occurences of charectors in string?
    By satheeshtech in forum New To Java
    Replies: 3
    Last Post: 01-06-2010, 10:31 AM

Tags for this Thread

Posting Permissions

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