I am a Java beginner and trying to get a console blackjack to run. I created an ArrayList with cards as Strings, such as "3 Spades". Now I need to check for the values so that I dont get more than 21 for example. I have tried giving all of the Strings ints but it that isnt working for me. Is there a way to filter only the numbers out of the String and save as an int? Thanks for your help.
public ArrayList<String> Karten () {
ArrayList<String>Herz = new ArrayList<String>(
Arrays.asList(" 2 Herz "," 3 Herz "," 4 Herz "," 5 Herz "," 6 Herz "," 7 Herz "," 8 Herz "," 9 Herz "," 10 Herz ", " Bube Herz ", " Dame Herz ", " König Herz ", " Ass Herz "));