Object[] help

Discussion in 'Plugin Development' started by PatoTheBest, Mar 25, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    PatoTheBest

    Code:java
    1. this.logger.log(Level.INFO, "[{0}] Version {1} Has Been Enabled!", new Object[]{pdfFile.getName(), pdfFile.getVersion()});

    How do you make it so it replaces all the things on the object with the {1}, {2} and so on like on the code above?
     
  2. Offline

    2MBKindiegames

    I think this is what you need:
    Code:java
    1. Object[] obj = new Object[]{pdfFile.getName(), pdfFile.getVersion()};
    2. getLogger().log(Level.INFO, "["+obj[0]+"] Version {"+obj[1]+"} Has Been Enabled!");
     
  3. Offline

    PatoTheBest

    The code I gave works, I wanted to know the script they use to change the string into objects.
     
  4. Offline

    2MBKindiegames

    You mean something like
     
Thread Status:
Not open for further replies.

Share This Page