String calculate

Discussion in 'Plugin Development' started by creppii, Feb 9, 2014.

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

    creppii

    Hey Again :p

    my question is: can i convert a string to a int or can i calculate with a string?
    because when i try to calculate this:
    Code:java
    1. p.sendMessage("Anzahl: " + anzahl);
    2. p.sendMessage("Preis: " + (anzahl * preis1));

    theres an error: The operator * is undefined for the argument type(s) String, int
    how can i calculate the String "anzahl" with the int "preis1"
    Code:java
    1. int preis1 = 2;
    2. String anzahl = args[0];
     
  2. Offline

    Harmings

    creppii
    Integer.parseInt(String);
    If I understand correctly what you're asking
     
  3. Offline

    creppii

Thread Status:
Not open for further replies.

Share This Page