Campbell Ritchie wrote:Do you mean like the ATTACHED type in Eiffel?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Vaishali Kulkarni - Boston wrote:iterate the string using charAt(index) and for each char ch:
Character.isDigit(ch)
I had forgotten about that. Even though I would appear to have been the first person to mention it on this discussion!Mike Simmons wrote: . . . Character.isDigit() . . .
Mike Simmons wrote:In comparison, Character.isDigit() simply works.
Bob Robertson wrote:Hello,
I have a situation where I want to validate whether the value passed in as a String() is a numeric v. alpha/special char value. The process that will consume this data post-validation will be expecting numeric values.
Can someone give me a hint with how to do this without using a NumberFormatException? If the Exception is encountered the only recovery necessary will be to log the data that needs to be reviewed since the data is subjective and cannot be modified at runtime based on any conditions. I could just try to catch a NFE when trying to convert the value to an integer and then log that that data needs to be eye-balled, but I was hoping to do something a little more purdy.
If I were to use the java regex uitils, would I be provided a means to eliminate all alpha and special characters?
Just looking for a thums-up/thumbs-down or a possible alternative.
Thanks!
bo-bizzle po-pizzle
and won't match0
0000000000000
00000000000001
1234567890
123456789012346789012345689012345678901234567890
I would still preferorRemember that a Scanner has these three methods: 1 2 3.-1
-0
-1234567890
1 + 1 = 10 is always one of the plausible truths for me.
I am afraid I would disagree. You are using exceptions for control flow in lines 5‑9. Rather than using that awkward construct if (b) … { … something … } else { … somethingDifferent … } in lines 20‑24., have a look at the old Sun style guide. WriteThe name of your method is confusing: all Strings are Strings. The String "12345" is still a String.Mark Ii wrote:. . . this is the way. . . .
1 + 1 = 10 is always one of the plausible truths for me.
orNon-numeric text
...or similar.Ordinary text
Carey Brown wrote:Do you allow:....
I see the original replier is still around. If I remember correctly, that was 13th October, when the person who posted the first reply signed upCarey Brown wrote:. . . a 15 year old post. The original poster[...]'s not around . . .
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |