This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hey, I need a bit of help managing to strip non-numeric characters from a string, if I remember right, I use a boolean and char app for this, but I can't get it right so I was hoping someone here would be able to give me a little help with this.
I am really really confused as to why you think that stripping characters from a string has anything to do with Boolean.
If regular expressions are a bit beyond your grasp at this point, just do it the old-fashioned way. What steps would you go through to accomplish this task?
If you have a hard time starting with that, let's approach it from a more real-world direction: You have a bowl full of beans with some stones mixed in with them. What steps would you use to end up with a bowl full of beans but no stones?
Bear Bibeault wrote:Nothing to do with stripping characters.
Or phone numbers, which actually confused me even more.
(Okay, I get a lot of false phone numbers, but my dating life is none of your business.)
What kinds of characters are you trying to remove? Have you considered replacing those characters with an empty string? If you look at the java.lang.String API you might find some methods for doing just that.
David Crane wrote:yes, I do want a bowl of beans, how do I do that in code
I think that you mssed the point entirely. Bear is suggesting that you do it without a computer first. Understand the process. And then translate it to code.
If you understand the process (with a physical pile of beans), then you'll understand how to do that in code.
David Crane wrote: I had thought the method you use was related to booleans, so I am grateful for the assitance
Here is something that may help you... Besides conditions (as if using the "if", "for", or "while" keyword), which probably applies to all programs. Looking into Booleans is a red-herring. Don't waste any more time on it.