OpenMS/OpenMS — pull request #845 by hroest (2014-05-24 11:04:54+00:00)
Title: [FEATURE] replace String classes with StringUtils

This is a first attempt to tackle issue #448 by putting most OpenMS::String functions into a utility header file called StringUtils. Basically the idea is to have simple, independent functions to perform operations on strings and would allow us to replace OpenMS::String (at least partially) with time. Currently one way to do this would be:

- constructors should be replaced with a `toString` function
- const functions should be replaced with an external function call, e.g. use ``StringUtils::hasPrefix` instead of `s.hasPrefix` which de-entangles the code to a certain extend
- Chainable mutators (in OpenMS::String all those that are non-const _and_ return `String &`) will be a real pain because there is no way to simply replace with them with an external function since they will not operate on temporary String objects. This would make chaining of of mutators impossible, e.g. `String("aha ").trim().toLower()` would not really work with external utility functions (unless we copy the object but then all function calls which expect the underlying object to be modified, like `s.trim()`, would have to be replaced with the function and the assignment, otherwise the code breaks
- same goes for operators but to an even larger extend

the main question is whether we would like to move on this and if so, what the way forward should be. One big advantage of the current OpenMS::String class are its utility classes that directly operate on the object and allows us to chain operators in a very easy and intuitive matter, basically writing things like `String("aha ").trim().toLower() + 2.0` which would be much harder without such a class.

Another question is whether it would be beneficial to at least have parts of the class outsourced to StringUtils, e.g. const functions only. Then at least it would be clearer what is part of the actual String class and which parts are simply utility functions. Any thoughts on this?