Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java:56: cannot find symbol error in refrence to 'substring'???

807599Apr 3 2007 — edited Apr 3 2007
I've written a program for a school assignment that (should) reads from a text file line by line and formats the data it receives. The method listed below is called upon to find a 7 character chunk of data in the string and then return it. Every time I compile the program I get this error:
---------------------------------------------------------------
NWSFB05.java:56: cannot find symbol
symbol : method substring(java.lang.String,java.lang.String)
location: class java.lang.String
strOut = StationWeather.substring(getPos(strAlt), getPos(strAlt)+7) + " ";
______________________^
1 error
----------------------------------------------------------------


This may be a stupid question but I'm new to java and I could not find an answer on the forums that had been previously posted. Any help would be great ^_^

Code:
public String getAltWea(String strAlt)

  {

    String strOut = "";

    /** Extracts the seven character string from Station Weather
    Adds a space on the end so that we can easily work with the string */
    
	 strOut = StationWeather.substring(getPos(strAlt), getPos(strAlt)+7) + " ";

    /** We are looking for the end of the Altitude Weather and then
    we pad the end with more spaces */
    strOut = strOut.substring(0,strOut.indexOf(" ",0)) + "       ";

    /** Now chop the thing down to EXACTLY seven spaces */
    strOut = strOut.substring(0,7);

    return strOut;

  } 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2007
Added on Apr 3 2007
5 comments
1,828 views