In short, it's not working right for me.
In long:
The program is designed to read numbers from an accumulator and speak
them out loud. Unfortunately, the class that contains the method to
read off large numbers is only for integers. My intention is to split
a String across the Regex of ".". However, this code does not work:
private void doRealValueOf(String text) {
BBI beforeDot, afterDot;
String decArray[];
decArray = text.split(".", 2);
beforeDot = new BBI(decArray[0]);
afterDot = new BBI(decArray[1]);
beforeDot.play();
playString("point.au");
sleep(400);
afterDot.play();
}
Please assume as your read that all of the called methods except
text.split(".") works.
I can _guarantee_ by use of a debugger that text does not have the
regex in more than one place. In my test case, "4.0", the output of
text.split(".") is
text.split(".")
(java.lang.String[]) []
I really cannot fathom why this might be the case.
For reference, the output of the two argument split methods are as
follows:
text.split(".", 0)
(java.lang.String[]) []
text.split(".", 1)
(java.lang.String[]) [4.0]
text.split(".", 2)
(java.lang.String[]) [, .0]
And calling the toString method on the String text:
text
(java.lang.String) 4.0
These are all from the _exact same instant_ of the virtual machine;
the thread that all these variables are in is suspended, so there is
no chance of something being incorrect due to changes in the state of
the locals.
Please help me. I'm starting to get desperate. I've been working on
this one problem for more than two hours now, and it is my only
roadblock to success. Anyone who can help, please do so.