Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Need help in Java char[]...

Name: Anonymous 2007-04-28 19:19 ID:r3l/lAht

Okay guys... I have a char[] suposely made of A's, B's and C's...

If I find a character that isn't one of those, I want it to throw an exception and leave.

how do I do it?

char[] zong = {A,L,C,B,}

for (int k = 0; k < zong.length; k++ ) {
if ((zong[k] != A) && (zong[k] != B) && (zong[k] != C)) {
throw new Exception("exit");
}
}

Is this it?

thanks, /prog/

Name: Anonymous 2007-04-30 1:53 ID:LCsVhMJm


case takeWhile (`elem` "ABC") zong of
    [] -> zong
    _  -> error "error"

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List