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;
}