I want to have functions that convert numeric values into strings in English words, to pluralize nouns, to inflect, break by words and so on. I will use these throughout a big project. Normally I would put them as pure static methods in a StringHelper class with nothing but static methods. But it there a better way to organize it to avoid static methods and helpers?
As usual it depends.
If you only works with one locale and don't need any kind of state for your process, you can handle everything static and you're fine.
However if you intend to have multiple languages where rules to pluralizes, break words can change, you will probably needs :
- A general interface exposing every function for string manipulation
- A factory that take the Locale for your request and return the right implementation of the interface.
Otherwise instead of having all static you could remove the static and use the new. Just in case you process a lot of text at once be sure to instantiate only once, and not in a loop where the potentially very numerous instantiation would be only wasting time and memory (like a loop for every word in a text).
Also I hope you don't intend to handle that kind of stuff manually, thought it seems easy in fact it is really hard. There are stuff already done and available for that, for instance this one for Java. Though it could probably used a intermediary layer of encapsulation to only do what you need without having for all users of your function how to use that class.