Jump to content

Photo
* * * * * 1 votes

Java - jak wczytać String do Inta

How to convert string to int konwersja string do int java programowanie

Best Answer zonic, 01 January 2014 - 23:14

Albo:
 

Integer x = Integer.valueOf(str);

Albo:

int y = Integer.parseInt(str);

Gdzie str to oczywiście zmienna typu String przechowująca ciąg typu: "12345".

Go to the full post


1 reply to this topic
  • This topic is locked This topic is locked
ernest
6
Neutralna

Posted 01 January 2014 - 21:40

#1

Wczytuję z pliku dane w postaci:
 

12 43 543
2 898 786
23 89 123

Jednak dane udaje mi się przejąć do zmiennych typu String. Jak zamienić je na int?


  • 0

zonic

    WT Elite

  • 2911 posts
    • Czas spędzony online: 134d 2h 28m 23s
472
Znakomita!
  • LocationToruń

Posted 01 January 2014 - 23:14   Best Answer

#2

Albo:
 

Integer x = Integer.valueOf(str);

Albo:

int y = Integer.parseInt(str);

Gdzie str to oczywiście zmienna typu String przechowująca ciąg typu: "12345".


  • 0





Podone tematy Collapse


Also tagged with one or more of these keywords: How to convert string to int, konwersja string do int, java, programowanie

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users