String Processing Class for JavaDemo2Vers2
public class StringProcessor
{
public static int getNumValue(String str)
{
Integer tempInt;
int startPos;
String numString = new String();
String trimmedString;
String tempStr = "this is a line with strings and a number";
startPos = tempStr.length();
numString = str.substring(startPos);
trimmedString = numString.trim(); //trims whitespace from both ends
System.out.println("Number is " + trimmedString);
tempInt = Integer.valueOf(trimmedString);
return tempInt.intValue();
}
}