Hello all, I was wondering on how I would extract a number out of a String after a specified character. For example, if String s = "22+5+35" , how can I extract and store the numbers 22,5, and 35 in a ArrayList?
If you want to do a split (and the purpose is to obtain only digit characters), use regular expression that splits at any non-digit character (i.e. "[^\d]+"). Then you would get an array containing only digit characters.
If you are dealing with mathematic expressions, spliting a string into a char array would be OK because you will need to deal with the whole string (numbers & operands).