Jeanne Boyarsky wrote:Fun! It sounds like you need an array or ArrayList. It also sounds like you need a Car class.
timothy adigun wrote:
The Regex, that will work for you can be coined in several ways:
You could you use:
which is also the same things as this
You take the first group, starting from the start of the string, take from 1 to several of the "integer" which ranges from 0 to 9.
That is the group you wanted and so you can then print it out.
I will also suggest that you take a look at this https://docs.oracle.com/javase/tutorial/essential/regex/index.html
Henry Wong wrote:
David Martínez wrote:
How should it be the Regex to work the way I need?
First, with regular expressions, it isn't as simple as the regex string itself. You need to tell us how is the regular expression being applied.
And second, you need to tell us which regular expression you are using -- as regular expressions are available in a multitude of languages and frameworks. At this point, I can clearly say that this question is in the wrong forum, but I can't say where it should be moved to!!
Sergiu Dobozi wrote:I tried to figure it out and with pen and paper and I can only do this with a for loop.
Let's say if you have the number 10, this program tests if 10-0*3 divides by 5, then assigns 10/5 the number of 5cents you need.
If you have 11 then 11-0*3 does not divide by 5. It's only when b=2 that it becomes true. so 11-2*3 divides by 5 and then you have the number of 3cents and you can pull out from the loop.