substring problems for java noobie
From: Don Freeman (freemand_at_sonic.net)
Date: 12/02/04
- Next message: Casey Hawthorne: "Re: substring problems for java noobie"
- Previous message: Rio: "Design question - HTML table parser"
- Next in thread: Casey Hawthorne: "Re: substring problems for java noobie"
- Reply: Casey Hawthorne: "Re: substring problems for java noobie"
- Maybe reply: Don Freeman: "Re: substring problems for java noobie"
- Maybe reply: Casey Hawthorne: "Re: substring problems for java noobie"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 02 Dec 2004 01:16:17 GMT
Seems like whatever value I use for the first int field (starting position)
the substring procedure negates it and triggers a String index out of range
error.
I've tried all sorts of work arounds to no avail, am I defining the two
string variable incorrectly?
code snippet:
String lastChar = new String();
String imageDir = new String();
<...>
System.out.println(imageDir); //debug = C:\images\
//ok so far but:
lastChar = imageDir.substring(2,1);
//triggers: String index out of range: -1: -- this value is always the
negated value +1 of the of the starting position value.
I'm starting to lose hair over this so any help will also help keep my
barber in business.
Thanks,
Don Freeman
- Next message: Casey Hawthorne: "Re: substring problems for java noobie"
- Previous message: Rio: "Design question - HTML table parser"
- Next in thread: Casey Hawthorne: "Re: substring problems for java noobie"
- Reply: Casey Hawthorne: "Re: substring problems for java noobie"
- Maybe reply: Don Freeman: "Re: substring problems for java noobie"
- Maybe reply: Casey Hawthorne: "Re: substring problems for java noobie"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|