I'm writing a program to parse a user entered string. My textbook does not include the .find() function, but I found it in an old C++ book (Ivor Horton's Beginning C++, the Complete Language) is the .find() considered bad, or depricated? It seems to work really well, but I don't want to use things that are not up to standard, I want to avoid bad habits, as I've got enough I'm trying to break already.
The .find() function (in string class) is perfectly fine. I've never heard anybody say that there was anything wrong with it. It's a simple function to find a matching character or string within a string, what could go wrong with that?
In general, the only standard functions that one could say are deprecated or not recommended will be found within the legacy C libraries (any header starting with "c", like <cstdlib> or <cstring>) because some of them are not safe or have bad style.
Since C++11, one might argue that if you are doing a lot of string manipulations, such as finding particular tokens in a string, or some other general form of parsing, then it would be preferrable to use the <regex> (docs) library instead. However, regex is not widely available yet on compilers, and it's not the easiest library to work with. You only need for more serious parsing (an intermdiate between using simple string functions, and using a real parser generator library like Yacc, Bison or Boost.Spirit.
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);