ciąg do int java
String number = "10";
int result = Integer.parseInt(number);
System.out.println(result);
Copy
Tame Thrush
String number = "10";
int result = Integer.parseInt(number);
System.out.println(result);
Copy
// You will receive an error if there are non-numeric characters in the String.
String num = "5";
int i = Integer.parseInt(num);
String year = "2022";
int a = Integer.parseInt(year);
var text = '42px';
var integer = parseInt(text, 10);
// returns 42
int i=Integer.parseInt("200");
public int stringToInt(String str) {
// deleting everything that is not numeric
return Integer.parseInt(str.replaceAll("[^0-9.]",""));
}