| Author |
SubString PROBLEM. HELP ASAP!!!
|
Gabriel Collet
Greenhorn
Joined: Feb 15, 2005
Posts: 7
|
|
Hi everyone. I�m kind of a newbie. I�m trying to use the function subString in the following way but haven�t been able to make it work String nom=sb.subString(4); where nom has been defined at the beginning as a public String and sb is a stringbuffer with the string of information i want to divide into substrings. This is the error message I get. cannot resolve symbol symbol : method subString (int) location: class java.lang.StringBuffer String nom=sb.subString(4) PLEASEEEEE, CAN ANYONE GIVE ME A HAND OR SEND ME AN APPLICATION WHERE THIS WORKS!!! THANKS
|
 |
M Beck
Ranch Hand
Joined: Jan 14, 2005
Posts: 323
|
|
you've misspelled "substring". note, no capital letters. the easiest and quickest way to fix this sort of problems, i've found, is to go looking in the Java API documentation for the class or method you want to use. it's amazing what you can find in there!  [ February 15, 2005: Message edited by: M Beck ]
|
 |
Liam Tiarnach
Ranch Hand
Joined: Aug 06, 2004
Posts: 51
|
|
This is the error message I get. cannot resolve symbol symbol : method subString (int) location: class java.lang.StringBuffer String nom=sb.subString(4) PLEASEEEEE, CAN ANYONE GIVE ME A HAND OR SEND ME AN APPLICATION WHERE THIS WORKS!!! THANKS
Remember, Errors are your friends... The error states, "Hey dude, I can't resolve this symbol... You said it's a method called subString, but looking at java.lang.String buffer, I can not find a method with that signature... what gives? by the way here is your code... String nom=sb.subString(4) check spelling or something" so let take a look at the java.lang.StringBuffer API... and what do you know, there is no subString(int) method, in this case its because looking at the API, the method name substring is all in lowercase... Which is funny, because one would think that having the first letter of the second word in the method name capitalized would follow the accepted coding conventions... but go figure... Hope this helps...
|
- Liam...<br />- ' He who never sleeps... '
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
And please take a look at both http://faq.javaranch.com/view?EaseUp and http://faq.javaranch.com/view?KeepItDown - thanks!
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
|
|
Originally posted by Liam Tiarnach: and what do you know, there is no subString(int) method, in this case its because looking at the API, the method name substring is all in lowercase... Which is funny, because one would think that having the first letter of the second word in the method name capitalized would follow the accepted coding conventions... but go figure...
Depends on whether you count "sub-string" as one word or two; sub is not a true word in and of itself; it is simply a morpheme meaning "under" or "lesser." As such, it is one word. (you wouldn't write a method called subMarine() or subJugate()...) On the other hand, I always write subString and the compiler has to tell me "no, no, no" , so there you go.
|
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
|
 |
M Beck
Ranch Hand
Joined: Jan 14, 2005
Posts: 323
|
|
Originally posted by Joel McNary: Depends on whether you count "sub-string" as one word or two; sub is not a true word in and of itself; it is simply a morpheme meaning "under" or "lesser." As such, it is one word. (you wouldn't write a method called subMarine() or subJugate()...)
well, no, but somebody did decide to write a String.subSequence(), so...
|
 |
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
|
|
So, would you apply the same logic to "System.arraycopy"? I do consider substring to be a single word, however -- subsequence too.
|
 |
 |
|
|
subject: SubString PROBLEM. HELP ASAP!!!
|
|
|