Computer Science Canada string.indexof question |
Author: | shadowman571 [ Tue Oct 23, 2007 9:41 am ] |
Post subject: | string.indexof question |
im in class and my teacher is trying to teach us how to use . length in "somestring.indexof(0,0) what does the second 0 do? my teacher is unsure of this can any one help? a quick answer would be realy helpful |
Author: | rdrake [ Tue Oct 23, 2007 9:52 am ] | ||
Post subject: | Re: string.indexof question | ||
A whisper in my ear tells me it would do this: Quote: indexOf(String str, int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index. So uh... probably the same thing as
|
Author: | HeavenAgain [ Tue Oct 23, 2007 10:40 am ] |
Post subject: | RE:string.indexof question |
i believe it does something like <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#indexOf(int,%20int)">this</a> api is always useful, and you can always test out the code at the interaction. |
Author: | Aziz [ Sun Oct 28, 2007 12:46 pm ] |
Post subject: | RE:string.indexof question |
Whoa whoa whoa. Don't link him to old docs. 1.4 is much different than 1.6, though not in this case. Here is the newest api docs: http://java.sun.com/javase/6/docs/api/ I usually just google "java 6 whatever" where whatever is the class I'm looking for. For example: google "java 6 String" and the first result is: http://java.sun.com/javase/6/docs/api/java/lang/String.html Your teacher doesn't sound like much of a programmer, at least with java. Is this highschool or college? |
Author: | Nick [ Sun Oct 28, 2007 12:55 pm ] |
Post subject: | RE:string.indexof question |
lol its Mr Holmes he was my turing teacher last year anyway he's a programmer used to tell us stories of his old work and whatnot but i hear he is HORRIBLE at java seen him carrying around like 10 "java for dummies" books |
Author: | Aziz [ Sun Oct 28, 2007 12:59 pm ] |
Post subject: | RE:string.indexof question |
Tell him about javadocs. Seriously. Java isn't java without 'em. |
Author: | shadowman571 [ Sun Oct 28, 2007 7:25 pm ] |
Post subject: | Re: string.indexof question |
alright all thanks for the help |
Author: | Nick [ Tue Oct 30, 2007 12:15 pm ] |
Post subject: | Re: RE:string.indexof question |
momop @ Sun Oct 28, 2007 12:55 pm wrote: lol its Mr Holmes he was my turing teacher last year
anyway he's a programmer used to tell us stories of his old work and whatnot but i hear he is HORRIBLE at java seen him carrying around like 10 "java for dummies" books sorry what i meeant to say was he is a great teacher just apprently not with java :S |