Solved Use replaceAll with a list

Discussion in 'Spigot Plugin Development' started by Giorgino, Mar 10, 2020.

  1. Hi everyone, by chance someone can tell me how I can use replaceAll (1, 2); with a list?
     
  2. Strahan

    Benefactor

    Use it in what manner? Replace every item in the list with something else? Just loop the list and replace on each item. BTW, unless you're using regex, you should use replace not replaceAll.
     
    • Useful Useful x 1
  3. Wat?
     
    • Funny Funny x 1
  4. list.replaceAll(str -> str.replaceAll("regex", "replaced"))
     
    • Winner Winner x 1
  5. Code (Java):

    for(ListElement le : list= {
    le.replaceAll(1,2);
    }
     
    like this?
     
    • Useful Useful x 1