I'm not sure what techniques you can use to parse the String: "1, 2, and 3." and find the numeric digits that are to be replaced with text without looping.
switch statements are a way to "jump" to a block of code based on a value. Some think it a cleaner way to code than to use if/else if statements.
Can you use recursive methods? They can do things similar to looping.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
The switch statement can be replaced with if/else if statements that will do almost exactly the same thing.
To scan the contents of a String, you need a loop.
It is conceivable to write a program as if and else statements to cover all the possible combinations, but it would be huge, like a tree with many many many branches.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Question Answered as of 1 Year Ago by
NormR1
and
DavidKroukamp How do you get the char values from the String, skipping over the "," the "and" and the "."
and how do you call the method with each value that is found in the String
without a loop?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
So this was all a big waste of time. The parsing of the String is done by code that is not shown.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16