SFML community forums

General => Feature requests => Topic started by: pekl on August 13, 2008, 10:24:37 am

Title: sf::String append function
Post by: pekl on August 13, 2008, 10:24:37 am
In addition to the setText functions, it would be nice to have an append function. Even better would be if it could handle different data types such as integers and floats.

for example, if you would like to display scores in a game.

setText("score: ");
appendInt(4);
Title: sf::String append function
Post by: Laurent on August 13, 2008, 10:47:33 am
Like it is said in the tutorial, sf::String is a purely graphical class and has nothing to do with string manipulation. Just use std::string, std::ostringstream or whatever you prefer to format your text.
Title: sf::String append function
Post by: hacky on August 13, 2008, 09:10:04 pm
sprintf?
Title: sf::String append function
Post by: Laurent on August 13, 2008, 10:59:00 pm
Quote from: "hacky"
sprintf?

Not in C++.
Title: sf::String append function
Post by: Nexus on August 14, 2008, 06:18:40 pm
Just use std::stringstream and its operator<< to append values of any elementar type.