Negative array indices
Tyler Close
tyler@lfw.org
Thu, 15 Oct 1998 02:08:45 -0400
A while back, Ping and Mark were considering accepting negative array
indices as counting from the back of the array rather than the front.
I would like register a protest. I think this cuts down on your ability to
catch programming errors. Also, people often use -1 as a "not found" return
value when searching an array for a value. Witness the code snippet I
grabbed from one of Mark's posts:
>The code is:
>
> static public String aan(String rec) {
> if (rec.length() >= 1 && "aeiou".indexOf(rec.charAt(0)) != -1) {
> return "an " + rec;
> } else {
> return "a " + rec;
> }
> }
ciao,
Tyler