Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add substring function to sf::String #21
This would be better expressed as a constructor taking iterator arguments. Then substring could be expressed as sf::String(string.Begin() + pos, string.Begin() + pos + n); (Or as a non-member function performing this with some extra checks, as desired). A constructor using iterators would also enable a whole class of other useful construction techniques.
@Mankarse: It could be a feature too, but I believe a basic substring function would be easier to use.
In addition to OP's request, I suggest adding a Replace method for replacing occurrences in a sf::String object:
Link to discussion on the SMFL forum:
Even tho it's named sf::String, it's actually a visual element. Thanks to Laurent, it makes drawing text a hundred times easier.
Why would you want sf::String emulates std::string capabilities when you already have it ready for use? Keep in mind sf::String handles ANSI chars, wide strings and all that fun stuff internally already, plus let you choose which one you want to work with - as a design feature.
If you ask me, sf::String is already top notch, if you want something even more "high-level", you can always build a wrapper over it. That's what I did with SDL years ago.